Spaces:
Paused
Paused
Download node_modules/@plotly/mapbox-gl/src/style/zoom_history.js from Leon4gr45/UserSyncFrontend: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40plotly/mapbox-gl/src/style/zoom_history.js
- Command line
-
hf download hf://spaces/Leon4gr45/UserSyncFrontend/node_modules/@plotly/mapbox-gl/src/style/zoom_history.js
-
curl -L -o zoom_history.js https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40plotly/mapbox-gl/src/style/zoom_history.js
1.03 kB
| // @flow | |
| class ZoomHistory { | |
| lastZoom: number; | |
| lastFloorZoom: number; | |
| lastIntegerZoom: number; | |
| lastIntegerZoomTime: number; | |
| first: boolean; | |
| constructor() { | |
| this.first = true; | |
| } | |
| update(z: number, now: number) { | |
| const floorZ = Math.floor(z); | |
| if (this.first) { | |
| this.first = false; | |
| this.lastIntegerZoom = floorZ; | |
| this.lastIntegerZoomTime = 0; | |
| this.lastZoom = z; | |
| this.lastFloorZoom = floorZ; | |
| return true; | |
| } | |
| if (this.lastFloorZoom > floorZ) { | |
| this.lastIntegerZoom = floorZ + 1; | |
| this.lastIntegerZoomTime = now; | |
| } else if (this.lastFloorZoom < floorZ) { | |
| this.lastIntegerZoom = floorZ; | |
| this.lastIntegerZoomTime = now; | |
| } | |
| if (z !== this.lastZoom) { | |
| this.lastZoom = z; | |
| this.lastFloorZoom = floorZ; | |
| return true; | |
| } | |
| return false; | |
| } | |
| } | |
| export default ZoomHistory; | |