({ x, y }, zoom)
| 14 | } |
| 15 | |
| 16 | zoomToCommand ({ x, y }, zoom) { |
| 17 | const lastPosition = this.lastCameraMove |
| 18 | this.lastCameraMove = { pos: { x, y }, zoom } |
| 19 | const cameraZoomCommand = new SyncFunction(() => this.camera.zoomTo({ x, y }, zoom, 0)) |
| 20 | cameraZoomCommand.undoCommandFactory = () => { |
| 21 | if (lastPosition) { |
| 22 | return new SyncFunction(() => { |
| 23 | const { pos: { x, y }, zoom } = lastPosition |
| 24 | this.camera.zoomTo({ x, y }, zoom, 0) |
| 25 | }) |
| 26 | } |
| 27 | } |
| 28 | return cameraZoomCommand |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * May return command to reposition camera. |
no outgoing calls
no test coverage detected