* Pan * @param {[Number, Number]} pos - position on screen where the pointer is * @param {[Number, Number], optional} startPos - where the pointer grabbed at * the start of the operation. Must be supplied of `panStart()` was not called
({pos, startPos}: {pos: [number, number]; startPos?: [number, number]})
| 213 | * the start of the operation. Must be supplied of `panStart()` was not called |
| 214 | */ |
| 215 | pan({pos, startPos}: {pos: [number, number]; startPos?: [number, number]}): MapState { |
| 216 | const startPanLngLat = this.getState().startPanLngLat || this._unproject(startPos); |
| 217 | |
| 218 | if (!startPanLngLat) { |
| 219 | return this; |
| 220 | } |
| 221 | |
| 222 | const viewport = this.makeViewport(this.getViewportProps()); |
| 223 | const newProps = viewport.panByPosition(startPanLngLat, pos); |
| 224 | |
| 225 | return this._getUpdatedState(newProps); |
| 226 | } |
| 227 | |
| 228 | /** |
| 229 | * End panning |
no test coverage detected