isard 1.16.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +80 -0
- package/README.md +5 -5
- package/dist/basemap/vectortiles/placed.js +7 -4
- package/dist/basemap/vectortiles/placed.js.map +1 -1
- package/dist/basemap/vectortiles/tiles.d.ts +1 -1
- package/dist/basemap/vectortiles/tiles.js.map +1 -1
- package/dist/basemap/vectortiles/vectors.d.ts +3 -1
- package/dist/basemap/vectortiles/vectors.js +2 -0
- package/dist/basemap/vectortiles/vectors.js.map +1 -1
- package/dist/basemap/vectortiles.d.ts +1 -3
- package/dist/basemap/vectortiles.js +1 -3
- package/dist/basemap/vectortiles.js.map +1 -1
- package/dist/basemap/workerpool.d.ts +1 -1
- package/dist/basemap/workerpool.js.map +1 -1
- package/dist/bind/layers.js +2 -2
- package/dist/bind/layers.js.map +1 -1
- package/dist/decoder.worker.js +4 -5
- package/dist/decoder.worker.js.map +6 -6
- package/dist/decoding/decoders.d.ts +1 -1
- package/dist/decoding/decoders.js.map +1 -1
- package/dist/decoding/loader.d.ts +6 -3
- package/dist/decoding/loader.js +7 -5
- package/dist/decoding/loader.js.map +1 -1
- package/dist/decoding/protocol.d.ts +3 -2
- package/dist/decoding/protocol.js.map +1 -1
- package/dist/engine-loader.d.ts +20 -18
- package/dist/engine-loader.js +45 -42
- package/dist/engine-loader.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js.map +1 -1
- package/dist/isard_grid_bg.wasm +0 -0
- package/dist/isard_tess_bg.wasm +0 -0
- package/dist/isard_tiles3d_bg.wasm +0 -0
- package/dist/isard_webgl2_bg.wasm +0 -0
- package/dist/isard_webgpu_bg.wasm +0 -0
- package/dist/layers/custom.d.ts +35 -29
- package/dist/layers/custom.js +60 -46
- package/dist/layers/custom.js.map +1 -1
- package/dist/layers/extrusions.d.ts +6 -1
- package/dist/layers/extrusions.js +15 -4
- package/dist/layers/extrusions.js.map +1 -1
- package/dist/layers/features.js.map +1 -1
- package/dist/layers/flow.js.map +1 -1
- package/dist/layers/glyphs.d.ts +1 -1
- package/dist/layers/glyphs.js.map +1 -1
- package/dist/layers/ground.d.ts +21 -14
- package/dist/layers/ground.js +30 -9
- package/dist/layers/ground.js.map +1 -1
- package/dist/layers/icons.d.ts +1 -1
- package/dist/layers/icons.js.map +1 -1
- package/dist/layers/layers.d.ts +1 -2
- package/dist/layers/layers.js +3 -12
- package/dist/layers/layers.js.map +1 -1
- package/dist/layers/models.d.ts +7 -1
- package/dist/layers/models.js +19 -5
- package/dist/layers/models.js.map +1 -1
- package/dist/layers/network.d.ts +1 -1
- package/dist/layers/network.js.map +1 -1
- package/dist/layers/panoramas.d.ts +1 -0
- package/dist/layers/panoramas.js +3 -2
- package/dist/layers/panoramas.js.map +1 -1
- package/dist/layers/pointclouds.d.ts +3 -3
- package/dist/layers/pointclouds.js +3 -7
- package/dist/layers/pointclouds.js.map +1 -1
- package/dist/layers/raster.js +5 -0
- package/dist/layers/raster.js.map +1 -1
- package/dist/layers/symbols.js.map +1 -1
- package/dist/layers/tiles3d.d.ts +5 -7
- package/dist/layers/tiles3d.js +9 -18
- package/dist/layers/tiles3d.js.map +1 -1
- package/dist/layers/vectors.d.ts +10 -5
- package/dist/layers/vectors.js +25 -16
- package/dist/layers/vectors.js.map +1 -1
- package/dist/map/engine-settings.d.ts +5 -2
- package/dist/map/engine-settings.js +13 -2
- package/dist/map/engine-settings.js.map +1 -1
- package/dist/map/engines.d.ts +11 -26
- package/dist/map/engines.js +10 -48
- package/dist/map/engines.js.map +1 -1
- package/dist/map/frame-loop.d.ts +1 -3
- package/dist/map/frame-loop.js +3 -3
- package/dist/map/frame-loop.js.map +1 -1
- package/dist/map/hover-pick.d.ts +9 -3
- package/dist/map/hover-pick.js +29 -6
- package/dist/map/hover-pick.js.map +1 -1
- package/dist/map/layer-stack.d.ts +7 -8
- package/dist/map/layer-stack.js +6 -9
- package/dist/map/layer-stack.js.map +1 -1
- package/dist/map/symbol-atlases.d.ts +5 -4
- package/dist/map/symbol-atlases.js +8 -13
- package/dist/map/symbol-atlases.js.map +1 -1
- package/dist/map/viewshed.d.ts +1 -1
- package/dist/map/viewshed.js.map +1 -1
- package/dist/map.d.ts +45 -26
- package/dist/map.js +141 -90
- package/dist/map.js.map +1 -1
- package/dist/react/IsardMap.d.ts +1 -1
- package/dist/react/IsardMap.js.map +1 -1
- package/dist/react/VectorGeometry.d.ts +4 -1
- package/dist/react/VectorGeometry.js +5 -1
- package/dist/react/VectorGeometry.js.map +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/settings.d.ts +2 -0
- package/dist/settings.js +1 -1
- package/dist/settings.js.map +1 -1
- package/dist/types.d.ts +52 -22
- package/dist/types.js.map +1 -1
- package/dist/ui/interaction.d.ts +1 -1
- package/dist/ui/interaction.js.map +1 -1
- package/dist/util/animation.d.ts +1 -1
- package/dist/util/animation.js.map +1 -1
- package/dist/wasm/isard_tiles3d.d.ts +181 -0
- package/dist/wasm/isard_tiles3d.js +387 -0
- package/dist/wasm/{isard_core.d.ts → isard_webgl2.d.ts} +387 -182
- package/dist/wasm/{isard_core.js → isard_webgl2.js} +2087 -324
- package/dist/wasm/{isard.d.ts → isard_webgpu.d.ts} +195 -358
- package/dist/wasm/{isard.js → isard_webgpu.js} +1320 -1042
- package/package.json +4 -3
- package/vite.js +5 -4
- package/dist/isard_bg.wasm +0 -0
- package/dist/isard_core_bg.wasm +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interaction.js","sourceRoot":"","sources":["../../src/ui/interaction.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAGxC,kFAAkF;AAClF,MAAM,UAAU,GAAG,C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,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IACvF,CAAC;IAED,gGAAgG;IACxF,MAAM,CAAC,KAAa,EAAE,EAAS,EAAE,MAAM,GAAG,KAAK;QACrD,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5C,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;YAEzB,OAAO;QACT,CAAC;QACD,wEAAwE;QACxE,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC;QAC5B,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE;YACpB,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,UAAU,CAAC;YAEzG,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC;YAC3B,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAEjE,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["/**\n * Mouse, touch and keyboard controls. Every gesture only updates the camera and asks for a frame: the engine draws at most\n * once per display refresh, whatever the event rate of the device.\n */\n\nimport type { GeoMap } from '../map.ts';\nimport type { Point } from '../types.ts';\nimport { latitude, mercatorX, mercatorY, RAD } from '../util/geo.ts';\nimport { clamp } from '../util/math.ts';\nimport type { Camera } from '../wasm/isard.js';\n\n/** Zoom levels per wheel pixel (a mouse notch is about 100 px: 1/3 of a level) */\nconst WHEEL_RATE = 1 / 300;\n/** Share of the remaining wheel zoom applied per frame (smooth, about 150 ms to settle) */\nconst WHEEL_EASE = 0.3;\n/** Degrees per pixel when rotating or tilting with the mouse */\nconst ROTATE_RATE = 0.4;\n/** Degrees of tilt per CSS pixel two fingers move up or down together (MapLibre's rate) */\nconst TOUCH_PITCH_RATE = 0.5;\n/** CSS pixels a finger moves before a two-finger gesture is told: a tilt or a pinch */\nconst GESTURE_THRESHOLD = 6;\n/** A press that moves less than this (CSS pixels) is a click */\nconst CLICK_TOLERANCE = 4;\n/** Pan speed kept on release, decaying with this time constant (ms) */\nconst INERTIA_DECAY = 280;\n\n/** CSS pixels per arrow key press */\nconst KEY_PAN = 100;\n/** Degrees per Shift + left or right arrow */\nconst KEY_BEARING = 15;\n/** Degrees per Shift + up or down arrow */\nconst KEY_PITCH = 10;\n/** Duration of the moves made by keys, milliseconds */\nconst KEY_DURATION = 300;\n\n/** What a key does to the camera: a pan in CSS pixels, a zoom, rotation or tilt step, or facing north */\nexport type KeyAction = { pan: Point } | { zoom: number } | { bearing: number } | { pitch: number } | { reset: true };\n\n/** The action of a key (`KeyboardEvent.key`), as MapLibre's: arrows pan (with Shift: rotate and tilt), + and - zoom\n * (with Shift: two levels), 0 faces north and levels the view */\nexport const keyAction = (key: string, shift: boolean): KeyAction | undefined => {\n switch (key) {\n case 'ArrowLeft':\n return shift ? { bearing: -KEY_BEARING } : { pan: [-KEY_PAN, 0] };\n case 'ArrowRight':\n return shift ? { bearing: KEY_BEARING } : { pan: [KEY_PAN, 0] };\n case 'ArrowUp':\n return shift ? { pitch: KEY_PITCH } : { pan: [0, -KEY_PAN] };\n case 'ArrowDown':\n return shift ? { pitch: -KEY_PITCH } : { pan: [0, KEY_PAN] };\n case '+':\n case '=':\n return { zoom: shift ? 2 : 1 };\n case '-':\n case '_':\n return { zoom: shift ? -2 : -1 };\n case '0':\n return { reset: true };\n default:\n return undefined;\n }\n};\n\n/** The camera after a key's action: a pan moves the center by that many CSS pixels on screen (the ground in view,\n * turned with the bearing, stretched by the tilt) */\nexport const keyCamera = (action: KeyAction, camera: Camera): Partial<Camera> => {\n if ('zoom' in action) return { zoom: camera.zoom + action.zoom };\n if ('bearing' in action) return { bearing: camera.bearing + action.bearing };\n if ('pitch' in action) return { pitch: Math.max(0, camera.pitch + action.pitch) };\n if ('reset' in action) return { bearing: 0, pitch: 0 };\n\n const b = camera.bearing * RAD;\n const [sx, sy] = [action.pan[0], action.pan[1] / Math.max(0.25, Math.cos(camera.pitch * RAD))];\n // Web Mercator units (0 to 1 across the world, y down); the world is 512 CSS pixels at zoom 0\n const world = 512 * 2 ** camera.zoom;\n const dx = (sx * Math.cos(b) - sy * Math.sin(b)) / world;\n const dy = (sx * Math.sin(b) + sy * Math.cos(b)) / world;\n const [lon, lat] = camera.center;\n const x = mercatorX(lon) + dx;\n const y = clamp(mercatorY(lat) + dy, 0, 1);\n const wrapped = ((((x * 360) % 360) + 360) % 360) - 180;\n\n return { center: [wrapped, latitude(y)] };\n};\n\n/** An element that takes the keys typed in it */\nconst editable = (target: EventTarget | null): boolean => {\n if (!(target instanceof HTMLElement)) return false;\n\n return target.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(target.tagName);\n};\n\ninterface Pointer {\n point: Point;\n start: Point;\n button: number;\n rotate: boolean;\n /** How far it moved since the two-finger gesture began (CSS pixels) */\n moved: Point;\n}\n\n/**\n * What two fingers do, once both moved (or one far, alone): a tilt if they lie side by side and both move up or down\n * together (as MapLibre and Google Earth take it), else a pinch (zoom, turn, pan); undefined before. A touch screen\n * sends the fingers' moves one after the other: the first one alone tells nothing yet\n */\nconst twoFingerGesture = (a: Pointer, b: Pointer): 'tilt' | 'pinch' | undefined => {\n const [ma, mb] = [Math.hypot(...a.moved), Math.hypot(...b.moved)];\n const [most, least] = [Math.max(ma, mb), Math.min(ma, mb)];\n\n if (most < GESTURE_THRESHOLD) return undefined;\n if (least < GESTURE_THRESHOLD / 2 && most < 2 * GESTURE_THRESHOLD) return undefined;\n\n const sideBySide = Math.abs(a.point[1] - b.point[1]) < Math.abs(a.point[0] - b.point[0]);\n const vertical = (q: Pointer) => Math.abs(q.moved[1]) > 2 * Math.abs(q.moved[0]);\n const together = Math.sign(a.moved[1]) === Math.sign(b.moved[1]);\n const both = Math.min(Math.abs(a.moved[1]), Math.abs(b.moved[1])) >= GESTURE_THRESHOLD / 2;\n\n return sideBySide && vertical(a) && vertical(b) && together && both ? 'tilt' : 'pinch';\n};\n\nexport class Interaction {\n private readonly pointers = new Map<number, Pointer>();\n private readonly cleanup: (() => void)[] = [];\n private wheel: { pending: number; at: Point } = { pending: 0, at: [0, 0] };\n /** What the two fingers on the map do, once told (`twoFingerGesture`) */\n private gesture: 'tilt' | 'pinch' | undefined;\n /** Recent pan moves, for the release speed: [time, dx, dy] */\n private trail: [number, number, number][] = [];\n private moved = false;\n /** The canvas's place on the page, read once: reading it on every pointer move would force a layout each time.\n * Read again after a resize, a scroll, and when a pointer comes in or goes down */\n private rect: DOMRect | undefined;\n /** A double click zooms in (Shift: out); off while the page takes double clicks (ending a drawing) */\n doubleClickZoom = true;\n /** A drag that turns and tilts goes around what is under the pointer where it starts (else around the center) */\n rotateAroundPointer = true;\n\n constructor(\n private readonly map: GeoMap,\n options: { keyboard?: boolean } = {},\n ) {\n const canvas = map.canvas;\n const listen = <K extends keyof HTMLElementEventMap>(\n type: K,\n handler: (e: HTMLElementEventMap[K]) => void,\n options?: AddEventListenerOptions,\n ) => {\n canvas.addEventListener(type, handler, options);\n this.cleanup.push(() => canvas.removeEventListener(type, handler));\n };\n const moved = () => {\n this.rect = undefined;\n };\n\n listen('pointerenter', moved);\n // Scrolls of the page or of any element holding the map\n if (typeof addEventListener === 'function') {\n addEventListener('scroll', moved, { capture: true, passive: true });\n this.cleanup.push(() => removeEventListener('scroll', moved, { capture: true }));\n }\n this.cleanup.push(map.on('resize', moved));\n listen('pointerdown', (e) => {\n this.rect = undefined;\n this.down(e);\n });\n listen('pointermove', (e) => this.move(e));\n listen('pointerup', (e) => this.up(e));\n listen('pointercancel', (e) => this.up(e));\n listen('pointerleave', (e) => {\n if (e.pointerType !== 'mouse') return;\n map.hover(undefined);\n map.emit('leave', {});\n });\n\n // On the container, the wheel zooms over markers and popups too\n const container = map.getContainer();\n const wheel = (e: WheelEvent) => this.onWheel(e);\n\n container.addEventListener('wheel', wheel, { passive: false });\n this.cleanup.push(() => container.removeEventListener('wheel', wheel));\n listen('dblclick', (e) => {\n if (this.doubleClickZoom && !this.map.firstPerson) this.zoomBy(e.shiftKey ? -1 : 1, this.local(e));\n });\n listen('contextmenu', (e) => e.preventDefault());\n if (options.keyboard ?? true) {\n // On the container: the keys work with the focus on a marker or a control too\n const key = (e: KeyboardEvent) => this.onKey(e);\n\n container.addEventListener('keydown', key);\n this.cleanup.push(() => container.removeEventListener('keydown', key));\n }\n }\n\n destroy(): void {\n this.cleanup.forEach((off) => {\n off();\n });\n }\n\n /** A gesture holds the map (pointers down): the camera has not stopped moving */\n get active(): boolean {\n return this.pointers.size > 0;\n }\n\n private local(e: MouseEvent): Point {\n this.rect ??= this.map.canvas.getBoundingClientRect();\n\n return [e.clientX - this.rect.left, e.clientY - this.rect.top];\n }\n\n private down(e: PointerEvent): void {\n this.map.canvas.setPointerCapture(e.pointerId);\n\n const point = this.local(e);\n const rotate = e.button === 2 || e.ctrlKey || e.shiftKey;\n\n this.pointers.set(e.pointerId, { point, start: point, button: e.button, rotate, moved: [0, 0] });\n // A new gesture: told again from here\n this.gesture = undefined;\n this.pointers.forEach((q) => {\n q.moved = [0, 0];\n });\n // A turn goes around what the pointer grabbed (a roof, a mesh, the relief); a pinch around the center\n if (rotate && this.rotateAroundPointer && this.pointers.size === 1 && !this.map.firstPerson) {\n this.map.engine.setPivot(...point);\n } else {\n this.map.engine.clearPivot();\n }\n this.trail = [];\n this.moved = false;\n // Grabbing the map stops any running animation (inertia, wheel zoom, easeTo)\n this.wheel.pending = 0;\n this.map.animate(undefined);\n }\n\n private move(e: PointerEvent): void {\n const point = this.local(e);\n const p = this.pointers.get(e.pointerId);\n\n if (!p) {\n if (e.pointerType === 'mouse') this.map.hover(point);\n\n return;\n }\n\n const [dx, dy] = [point[0] - p.point[0], point[1] - p.point[1]];\n\n if (Math.hypot(point[0] - p.start[0], point[1] - p.start[1]) > CLICK_TOLERANCE) this.moved = true;\n\n const eye = this.map.firstPerson;\n\n if (eye) {\n // At street level the drag turns the eye, the scene following the pointer as if grabbed\n const degrees = eye.fov / Math.max(1, this.map.canvas.clientHeight);\n\n this.map.setFirstPerson({ ...eye, bearing: eye.bearing - dx * degrees, pitch: eye.pitch + dy * degrees });\n p.point = point;\n\n return;\n }\n\n const engine = this.map.engine;\n const other = [...this.pointers.values()].find((q) => q !== p);\n\n p.moved = [p.moved[0] + dx, p.moved[1] + dy];\n if (this.pointers.size === 2 && other) this.gesture ??= twoFingerGesture(p, other);\n if (this.pointers.size === 2 && this.gesture === 'tilt') {\n // Both fingers up or down: the midpoint moves by half of this one's move\n engine.rotate(0, (-dy / 2) * TOUCH_PITCH_RATE);\n } else if (this.pointers.size === 2 && other && this.gesture === 'pinch') {\n // Pinch: zoom by the change of spread, turn by the change of angle, pan by the midpoint\n const before = Math.hypot(p.point[0] - other.point[0], p.point[1] - other.point[1]);\n const after = Math.hypot(point[0] - other.point[0], point[1] - other.point[1]);\n const angle = (q: Point) => Math.atan2(q[1] - other.point[1], q[0] - other.point[0]);\n const mid = (q: Point): Point => [(q[0] + other.point[0]) / 2, (q[1] + other.point[1]) / 2];\n\n engine.pan(...mid(p.point), ...mid(point));\n if (before > 0 && after > 0) engine.zoomAt(Math.log2(after / before), ...mid(point));\n engine.rotate((-(angle(point) - angle(p.point)) * 180) / Math.PI, 0);\n } else if (this.pointers.size === 2) {\n // Two fingers whose gesture is not told yet: a few pixels left out\n } else if (p.rotate) {\n engine.rotate(-dx * ROTATE_RATE, -dy * ROTATE_RATE);\n } else {\n engine.pan(p.point[0], p.point[1], point[0], point[1]);\n this.trail.push([e.timeStamp, dx, dy]);\n }\n p.point = point;\n this.map.requestRender();\n }\n\n private up(e: PointerEvent): void {\n const p = this.pointers.get(e.pointerId);\n\n if (!p) return;\n this.pointers.delete(e.pointerId);\n this.gesture = undefined;\n if (p.rotate) this.map.engine.clearPivot();\n // The next frame sends 'moveend' if the camera stays\n this.map.requestRender();\n if (!this.moved && e.type === 'pointerup' && p.button === 0 && this.pointers.size === 0) {\n this.map.emit('click', { point: p.point, lonLat: this.map.unproject(p.point) });\n\n return;\n }\n if (!p.rotate && this.pointers.size === 0 && !this.map.firstPerson) this.inertia(e.timeStamp, p.point);\n }\n\n /** Keeps panning at the release speed (last 50 ms), decaying exponentially */\n private inertia(now: number, from: Point): void {\n const recent = this.trail.filter(([t]) => now - t < 50);\n const first = recent[0];\n\n if (!first || recent.length < 2) return;\n\n const span = Math.max(16, now - first[0]);\n let vx = recent.reduce((s, [, dx]) => s + dx, 0) / span;\n let vy = recent.reduce((s, [, , dy]) => s + dy, 0) / span;\n\n if (Math.hypot(vx, vy) < 0.1) return;\n\n let last = performance.now();\n let point = from;\n\n this.map.animate((t) => {\n const dt = Math.min(64, t - last);\n\n last = t;\n\n const decay = Math.exp(-dt / INERTIA_DECAY);\n const next: Point = [point[0] + vx * dt, point[1] + vy * dt];\n\n this.map.engine.pan(point[0], point[1], next[0], next[1]);\n point = next;\n vx *= decay;\n vy *= decay;\n\n return Math.hypot(vx, vy) > 0.02;\n });\n }\n\n private onWheel(e: WheelEvent): void {\n e.preventDefault();\n\n // Lines (Firefox mouse wheels) are about 33 px\n const pixels = e.deltaMode === 1 ? e.deltaY * 33 : e.deltaY;\n const eye = this.map.firstPerson;\n\n if (eye) {\n // At street level: a narrower or wider field of view\n this.map.setFirstPerson({ ...eye, fov: eye.fov * Math.exp(pixels * 0.001) });\n\n return;\n }\n this.zoomBy(clamp(-pixels * WHEEL_RATE, -1, 1), this.local(e), e.deltaMode === 0 && Math.abs(pixels) < 40);\n }\n\n private onKey(e: KeyboardEvent): void {\n if (e.defaultPrevented || e.ctrlKey || e.metaKey || e.altKey || editable(e.target)) return;\n\n const action = keyAction(e.key, e.shiftKey);\n\n if (!action) return;\n e.preventDefault();\n\n const eye = this.map.firstPerson;\n\n if (eye) {\n // At street level the arrows turn the eye\n const turn = { ArrowLeft: [-10, 0], ArrowRight: [10, 0], ArrowUp: [0, 10], ArrowDown: [0, -10] }[e.key];\n\n if (turn)\n this.map.setFirstPerson({ ...eye, bearing: eye.bearing + (turn[0] ?? 0), pitch: eye.pitch + (turn[1] ?? 0) });\n\n return;\n }\n this.wheel.pending = 0;\n\n const reduced = typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches;\n\n this.map.easeTo(keyCamera(action, this.map.getCamera()), reduced ? 0 : KEY_DURATION);\n }\n\n /** Smooth zoom around a screen point; touchpads (`direct`) follow the fingers without easing */\n private zoomBy(delta: number, at: Point, direct = false): void {\n if (direct) {\n this.map.engine.zoomAt(delta, at[0], at[1]);\n this.map.requestRender();\n\n return;\n }\n // Accumulate: a second notch before the end of the first one adds to it\n this.wheel.pending += delta;\n this.wheel.at = at;\n this.map.animate(() => {\n const step = Math.abs(this.wheel.pending) < 0.002 ? this.wheel.pending : this.wheel.pending * WHEEL_EASE;\n\n this.wheel.pending -= step;\n this.map.engine.zoomAt(step, this.wheel.at[0], this.wheel.at[1]);\n\n return this.wheel.pending !== 0;\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interaction.js","sourceRoot":"","sources":["../../src/ui/interaction.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EA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asks for a frame: the engine draws at most\n * once per display refresh, whatever the event rate of the device.\n */\n\nimport type { GeoMap } from '../map.ts';\nimport type { Point } from '../types.ts';\nimport { latitude, mercatorX, mercatorY, RAD } from '../util/geo.ts';\nimport { clamp } from '../util/math.ts';\nimport type { Camera } from '../wasm/isard_webgpu.js';\n\n/** Zoom levels per wheel pixel (a mouse notch is about 100 px: 1/3 of a level) */\nconst WHEEL_RATE = 1 / 300;\n/** Share of the remaining wheel zoom applied per frame (smooth, about 150 ms to settle) */\nconst WHEEL_EASE = 0.3;\n/** Degrees per pixel when rotating or tilting with the mouse */\nconst ROTATE_RATE = 0.4;\n/** Degrees of tilt per CSS pixel two fingers move up or down together (MapLibre's rate) */\nconst TOUCH_PITCH_RATE = 0.5;\n/** CSS pixels a finger moves before a two-finger gesture is told: a tilt or a pinch */\nconst GESTURE_THRESHOLD = 6;\n/** A press that moves less than this (CSS pixels) is a click */\nconst CLICK_TOLERANCE = 4;\n/** Pan speed kept on release, decaying with this time constant (ms) */\nconst INERTIA_DECAY = 280;\n\n/** CSS pixels per arrow key press */\nconst KEY_PAN = 100;\n/** Degrees per Shift + left or right arrow */\nconst KEY_BEARING = 15;\n/** Degrees per Shift + up or down arrow */\nconst KEY_PITCH = 10;\n/** Duration of the moves made by keys, milliseconds */\nconst KEY_DURATION = 300;\n\n/** What a key does to the camera: a pan in CSS pixels, a zoom, rotation or tilt step, or facing north */\nexport type KeyAction = { pan: Point } | { zoom: number } | { bearing: number } | { pitch: number } | { reset: true };\n\n/** The action of a key (`KeyboardEvent.key`), as MapLibre's: arrows pan (with Shift: rotate and tilt), + and - zoom\n * (with Shift: two levels), 0 faces north and levels the view */\nexport const keyAction = (key: string, shift: boolean): KeyAction | undefined => {\n switch (key) {\n case 'ArrowLeft':\n return shift ? { bearing: -KEY_BEARING } : { pan: [-KEY_PAN, 0] };\n case 'ArrowRight':\n return shift ? { bearing: KEY_BEARING } : { pan: [KEY_PAN, 0] };\n case 'ArrowUp':\n return shift ? { pitch: KEY_PITCH } : { pan: [0, -KEY_PAN] };\n case 'ArrowDown':\n return shift ? { pitch: -KEY_PITCH } : { pan: [0, KEY_PAN] };\n case '+':\n case '=':\n return { zoom: shift ? 2 : 1 };\n case '-':\n case '_':\n return { zoom: shift ? -2 : -1 };\n case '0':\n return { reset: true };\n default:\n return undefined;\n }\n};\n\n/** The camera after a key's action: a pan moves the center by that many CSS pixels on screen (the ground in view,\n * turned with the bearing, stretched by the tilt) */\nexport const keyCamera = (action: KeyAction, camera: Camera): Partial<Camera> => {\n if ('zoom' in action) return { zoom: camera.zoom + action.zoom };\n if ('bearing' in action) return { bearing: camera.bearing + action.bearing };\n if ('pitch' in action) return { pitch: Math.max(0, camera.pitch + action.pitch) };\n if ('reset' in action) return { bearing: 0, pitch: 0 };\n\n const b = camera.bearing * RAD;\n const [sx, sy] = [action.pan[0], action.pan[1] / Math.max(0.25, Math.cos(camera.pitch * RAD))];\n // Web Mercator units (0 to 1 across the world, y down); the world is 512 CSS pixels at zoom 0\n const world = 512 * 2 ** camera.zoom;\n const dx = (sx * Math.cos(b) - sy * Math.sin(b)) / world;\n const dy = (sx * Math.sin(b) + sy * Math.cos(b)) / world;\n const [lon, lat] = camera.center;\n const x = mercatorX(lon) + dx;\n const y = clamp(mercatorY(lat) + dy, 0, 1);\n const wrapped = ((((x * 360) % 360) + 360) % 360) - 180;\n\n return { center: [wrapped, latitude(y)] };\n};\n\n/** An element that takes the keys typed in it */\nconst editable = (target: EventTarget | null): boolean => {\n if (!(target instanceof HTMLElement)) return false;\n\n return target.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(target.tagName);\n};\n\ninterface Pointer {\n point: Point;\n start: Point;\n button: number;\n rotate: boolean;\n /** How far it moved since the two-finger gesture began (CSS pixels) */\n moved: Point;\n}\n\n/**\n * What two fingers do, once both moved (or one far, alone): a tilt if they lie side by side and both move up or down\n * together (as MapLibre and Google Earth take it), else a pinch (zoom, turn, pan); undefined before. A touch screen\n * sends the fingers' moves one after the other: the first one alone tells nothing yet\n */\nconst twoFingerGesture = (a: Pointer, b: Pointer): 'tilt' | 'pinch' | undefined => {\n const [ma, mb] = [Math.hypot(...a.moved), Math.hypot(...b.moved)];\n const [most, least] = [Math.max(ma, mb), Math.min(ma, mb)];\n\n if (most < GESTURE_THRESHOLD) return undefined;\n if (least < GESTURE_THRESHOLD / 2 && most < 2 * GESTURE_THRESHOLD) return undefined;\n\n const sideBySide = Math.abs(a.point[1] - b.point[1]) < Math.abs(a.point[0] - b.point[0]);\n const vertical = (q: Pointer) => Math.abs(q.moved[1]) > 2 * Math.abs(q.moved[0]);\n const together = Math.sign(a.moved[1]) === Math.sign(b.moved[1]);\n const both = Math.min(Math.abs(a.moved[1]), Math.abs(b.moved[1])) >= GESTURE_THRESHOLD / 2;\n\n return sideBySide && vertical(a) && vertical(b) && together && both ? 'tilt' : 'pinch';\n};\n\nexport class Interaction {\n private readonly pointers = new Map<number, Pointer>();\n private readonly cleanup: (() => void)[] = [];\n private wheel: { pending: number; at: Point } = { pending: 0, at: [0, 0] };\n /** What the two fingers on the map do, once told (`twoFingerGesture`) */\n private gesture: 'tilt' | 'pinch' | undefined;\n /** Recent pan moves, for the release speed: [time, dx, dy] */\n private trail: [number, number, number][] = [];\n private moved = false;\n /** The canvas's place on the page, read once: reading it on every pointer move would force a layout each time.\n * Read again after a resize, a scroll, and when a pointer comes in or goes down */\n private rect: DOMRect | undefined;\n /** A double click zooms in (Shift: out); off while the page takes double clicks (ending a drawing) */\n doubleClickZoom = true;\n /** A drag that turns and tilts goes around what is under the pointer where it starts (else around the center) */\n rotateAroundPointer = true;\n\n constructor(\n private readonly map: GeoMap,\n options: { keyboard?: boolean } = {},\n ) {\n const canvas = map.canvas;\n const listen = <K extends keyof HTMLElementEventMap>(\n type: K,\n handler: (e: HTMLElementEventMap[K]) => void,\n options?: AddEventListenerOptions,\n ) => {\n canvas.addEventListener(type, handler, options);\n this.cleanup.push(() => canvas.removeEventListener(type, handler));\n };\n const moved = () => {\n this.rect = undefined;\n };\n\n listen('pointerenter', moved);\n // Scrolls of the page or of any element holding the map\n if (typeof addEventListener === 'function') {\n addEventListener('scroll', moved, { capture: true, passive: true });\n this.cleanup.push(() => removeEventListener('scroll', moved, { capture: true }));\n }\n this.cleanup.push(map.on('resize', moved));\n listen('pointerdown', (e) => {\n this.rect = undefined;\n this.down(e);\n });\n listen('pointermove', (e) => this.move(e));\n listen('pointerup', (e) => this.up(e));\n listen('pointercancel', (e) => this.up(e));\n listen('pointerleave', (e) => {\n if (e.pointerType !== 'mouse') return;\n map.hover(undefined);\n map.emit('leave', {});\n });\n\n // On the container, the wheel zooms over markers and popups too\n const container = map.getContainer();\n const wheel = (e: WheelEvent) => this.onWheel(e);\n\n container.addEventListener('wheel', wheel, { passive: false });\n this.cleanup.push(() => container.removeEventListener('wheel', wheel));\n listen('dblclick', (e) => {\n if (this.doubleClickZoom && !this.map.firstPerson) this.zoomBy(e.shiftKey ? -1 : 1, this.local(e));\n });\n listen('contextmenu', (e) => e.preventDefault());\n if (options.keyboard ?? true) {\n // On the container: the keys work with the focus on a marker or a control too\n const key = (e: KeyboardEvent) => this.onKey(e);\n\n container.addEventListener('keydown', key);\n this.cleanup.push(() => container.removeEventListener('keydown', key));\n }\n }\n\n destroy(): void {\n this.cleanup.forEach((off) => {\n off();\n });\n }\n\n /** A gesture holds the map (pointers down): the camera has not stopped moving */\n get active(): boolean {\n return this.pointers.size > 0;\n }\n\n private local(e: MouseEvent): Point {\n this.rect ??= this.map.canvas.getBoundingClientRect();\n\n return [e.clientX - this.rect.left, e.clientY - this.rect.top];\n }\n\n private down(e: PointerEvent): void {\n this.map.canvas.setPointerCapture(e.pointerId);\n\n const point = this.local(e);\n const rotate = e.button === 2 || e.ctrlKey || e.shiftKey;\n\n this.pointers.set(e.pointerId, { point, start: point, button: e.button, rotate, moved: [0, 0] });\n // A new gesture: told again from here\n this.gesture = undefined;\n this.pointers.forEach((q) => {\n q.moved = [0, 0];\n });\n // A turn goes around what the pointer grabbed (a roof, a mesh, the relief); a pinch around the center\n if (rotate && this.rotateAroundPointer && this.pointers.size === 1 && !this.map.firstPerson) {\n this.map.engine.setPivot(...point);\n } else {\n this.map.engine.clearPivot();\n }\n this.trail = [];\n this.moved = false;\n // Grabbing the map stops any running animation (inertia, wheel zoom, easeTo)\n this.wheel.pending = 0;\n this.map.animate(undefined);\n }\n\n private move(e: PointerEvent): void {\n const point = this.local(e);\n const p = this.pointers.get(e.pointerId);\n\n if (!p) {\n if (e.pointerType === 'mouse') this.map.hover(point);\n\n return;\n }\n\n const [dx, dy] = [point[0] - p.point[0], point[1] - p.point[1]];\n\n if (Math.hypot(point[0] - p.start[0], point[1] - p.start[1]) > CLICK_TOLERANCE) this.moved = true;\n\n const eye = this.map.firstPerson;\n\n if (eye) {\n // At street level the drag turns the eye, the scene following the pointer as if grabbed\n const degrees = eye.fov / Math.max(1, this.map.canvas.clientHeight);\n\n this.map.setFirstPerson({ ...eye, bearing: eye.bearing - dx * degrees, pitch: eye.pitch + dy * degrees });\n p.point = point;\n\n return;\n }\n\n const engine = this.map.engine;\n const other = [...this.pointers.values()].find((q) => q !== p);\n\n p.moved = [p.moved[0] + dx, p.moved[1] + dy];\n if (this.pointers.size === 2 && other) this.gesture ??= twoFingerGesture(p, other);\n if (this.pointers.size === 2 && this.gesture === 'tilt') {\n // Both fingers up or down: the midpoint moves by half of this one's move\n engine.rotate(0, (-dy / 2) * TOUCH_PITCH_RATE);\n } else if (this.pointers.size === 2 && other && this.gesture === 'pinch') {\n // Pinch: zoom by the change of spread, turn by the change of angle, pan by the midpoint\n const before = Math.hypot(p.point[0] - other.point[0], p.point[1] - other.point[1]);\n const after = Math.hypot(point[0] - other.point[0], point[1] - other.point[1]);\n const angle = (q: Point) => Math.atan2(q[1] - other.point[1], q[0] - other.point[0]);\n const mid = (q: Point): Point => [(q[0] + other.point[0]) / 2, (q[1] + other.point[1]) / 2];\n\n engine.pan(...mid(p.point), ...mid(point));\n if (before > 0 && after > 0) engine.zoomAt(Math.log2(after / before), ...mid(point));\n engine.rotate((-(angle(point) - angle(p.point)) * 180) / Math.PI, 0);\n } else if (this.pointers.size === 2) {\n // Two fingers whose gesture is not told yet: a few pixels left out\n } else if (p.rotate) {\n engine.rotate(-dx * ROTATE_RATE, -dy * ROTATE_RATE);\n } else {\n engine.pan(p.point[0], p.point[1], point[0], point[1]);\n this.trail.push([e.timeStamp, dx, dy]);\n }\n p.point = point;\n this.map.requestRender();\n }\n\n private up(e: PointerEvent): void {\n const p = this.pointers.get(e.pointerId);\n\n if (!p) return;\n this.pointers.delete(e.pointerId);\n this.gesture = undefined;\n if (p.rotate) this.map.engine.clearPivot();\n // The next frame sends 'moveend' if the camera stays\n this.map.requestRender();\n if (!this.moved && e.type === 'pointerup' && p.button === 0 && this.pointers.size === 0) {\n this.map.emit('click', { point: p.point, lonLat: this.map.unproject(p.point) });\n\n return;\n }\n if (!p.rotate && this.pointers.size === 0 && !this.map.firstPerson) this.inertia(e.timeStamp, p.point);\n }\n\n /** Keeps panning at the release speed (last 50 ms), decaying exponentially */\n private inertia(now: number, from: Point): void {\n const recent = this.trail.filter(([t]) => now - t < 50);\n const first = recent[0];\n\n if (!first || recent.length < 2) return;\n\n const span = Math.max(16, now - first[0]);\n let vx = recent.reduce((s, [, dx]) => s + dx, 0) / span;\n let vy = recent.reduce((s, [, , dy]) => s + dy, 0) / span;\n\n if (Math.hypot(vx, vy) < 0.1) return;\n\n let last = performance.now();\n let point = from;\n\n this.map.animate((t) => {\n const dt = Math.min(64, t - last);\n\n last = t;\n\n const decay = Math.exp(-dt / INERTIA_DECAY);\n const next: Point = [point[0] + vx * dt, point[1] + vy * dt];\n\n this.map.engine.pan(point[0], point[1], next[0], next[1]);\n point = next;\n vx *= decay;\n vy *= decay;\n\n return Math.hypot(vx, vy) > 0.02;\n });\n }\n\n private onWheel(e: WheelEvent): void {\n e.preventDefault();\n\n // Lines (Firefox mouse wheels) are about 33 px\n const pixels = e.deltaMode === 1 ? e.deltaY * 33 : e.deltaY;\n const eye = this.map.firstPerson;\n\n if (eye) {\n // At street level: a narrower or wider field of view\n this.map.setFirstPerson({ ...eye, fov: eye.fov * Math.exp(pixels * 0.001) });\n\n return;\n }\n this.zoomBy(clamp(-pixels * WHEEL_RATE, -1, 1), this.local(e), e.deltaMode === 0 && Math.abs(pixels) < 40);\n }\n\n private onKey(e: KeyboardEvent): void {\n if (e.defaultPrevented || e.ctrlKey || e.metaKey || e.altKey || editable(e.target)) return;\n\n const action = keyAction(e.key, e.shiftKey);\n\n if (!action) return;\n e.preventDefault();\n\n const eye = this.map.firstPerson;\n\n if (eye) {\n // At street level the arrows turn the eye\n const turn = { ArrowLeft: [-10, 0], ArrowRight: [10, 0], ArrowUp: [0, 10], ArrowDown: [0, -10] }[e.key];\n\n if (turn)\n this.map.setFirstPerson({ ...eye, bearing: eye.bearing + (turn[0] ?? 0), pitch: eye.pitch + (turn[1] ?? 0) });\n\n return;\n }\n this.wheel.pending = 0;\n\n const reduced = typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches;\n\n this.map.easeTo(keyCamera(action, this.map.getCamera()), reduced ? 0 : KEY_DURATION);\n }\n\n /** Smooth zoom around a screen point; touchpads (`direct`) follow the fingers without easing */\n private zoomBy(delta: number, at: Point, direct = false): void {\n if (direct) {\n this.map.engine.zoomAt(delta, at[0], at[1]);\n this.map.requestRender();\n\n return;\n }\n // Accumulate: a second notch before the end of the first one adds to it\n this.wheel.pending += delta;\n this.wheel.at = at;\n this.map.animate(() => {\n const step = Math.abs(this.wheel.pending) < 0.002 ? this.wheel.pending : this.wheel.pending * WHEEL_EASE;\n\n this.wheel.pending -= step;\n this.map.engine.zoomAt(step, this.wheel.at[0], this.wheel.at[1]);\n\n return this.wheel.pending !== 0;\n });\n }\n}\n"]}
|
package/dist/util/animation.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* camera of the engine in use at that frame (it may be replaced during a flight).
|
|
4
4
|
*/
|
|
5
5
|
import type { AnimationOptions, FlyToOptions } from '../types.ts';
|
|
6
|
-
import type { Camera, Engine } from '../wasm/
|
|
6
|
+
import type { Camera, Engine } from '../wasm/isard_webgpu.js';
|
|
7
7
|
/** A step of an animation, at `now` (milliseconds, the frame's time): false once done */
|
|
8
8
|
export type Step = (now: number) => boolean;
|
|
9
9
|
/** What a step needs of the engine, read at each frame */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animation.js","sourceRoot":"","sources":["../../src/util/animation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAQlC,mEAAmE;AACnE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAS,EAAU,EAAE;IACjD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAE5C,gEAAgE;IAChE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChH,IAAI,CAAC,GAAG,CAAC,CAAC;IAEV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,MAAM,CAAC,GAA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EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC;QAEtG,OAAO,CAAC,GAAG,CAAC,CAAC;IACf,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n * Camera animations: each is a step run every frame by the map (`GeoMap.animate`) until it returns false, setting the\n * camera of the engine in use at that frame (it may be replaced during a flight).\n */\n\nimport type { AnimationOptions, FlyToOptions } from '../types.ts';\nimport type { Camera, Engine } from '../wasm/isard.js';\nimport { fromMercator, toMercator } from './geo.ts';\nimport { clamp } from './math.ts';\n\n/** A step of an animation, at `now` (milliseconds, the frame's time): false once done */\nexport type Step = (now: number) => boolean;\n\n/** What a step needs of the engine, read at each frame */\ntype Target = () => Pick<Engine, 'setCamera' | 'clearPreload'>;\n\n/** MapLibre's default easing: cubic Bézier (0.25, 0.1, 0.25, 1) */\nexport const defaultEasing = (t: number): number => {\n if (t <= 0 || t >= 1) return clamp(t, 0, 1);\n\n // Solve x(u) = t for the curve parameter, Newton then bisection\n const [x1, y1, x2, y2] = [0.25, 0.1, 0.25, 1];\n const bezier = (u: number, a: number, b: number) => 3 * a * u * (1 - u) ** 2 + 3 * b * u * u * (1 - u) + u ** 3;\n let u = t;\n\n for (let i = 0; i < 8; i += 1) {\n const x = bezier(u, x1, x2) - t;\n const dx = 3 * x1 * (1 - u) ** 2 + 6 * (x2 - x1) * u * (1 - u) + 3 * (1 - x2) * u * u;\n\n if (Math.abs(x) < 1e-6 || dx === 0) break;\n u = clamp(u - x / dx, 0, 1);\n }\n\n return bezier(u, y1, y2);\n};\n\n/** The step of an animated move from `from` to `to`: over `duration` milliseconds (or the options), ease-out by\n * default, the bearing turning the shortest way round */\nexport const easeTo = (engine: Target, from: Camera, to: Camera, options: number | AnimationOptions = 600): Step => {\n const { duration = 600, easing = (t: number) => 1 - (1 - t) ** 3 } =\n typeof options === 'number' ? { duration: options } : options;\n // Shortest way round\n const turn = ((to.bearing - from.bearing + 540) % 360) - 180;\n const start = performance.now();\n\n return (now) => {\n if (now - start >= duration) engine().clearPreload();\n\n const t = duration > 0 ? Math.min(1, (now - start) / duration) : 1;\n const k = easing(t);\n const mix = (a: number, b: number) => a + (b - a) * k;\n\n engine().setCamera(\n mix(from.center[0], to.center[0]),\n mix(from.center[1], to.center[1]),\n mix(from.zoom, to.zoom),\n mix(from.pitch, to.pitch),\n from.bearing + turn * k,\n );\n\n return t < 1;\n };\n};\n\n/**\n * The step of a flight from `from` to `to` that zooms out on its way and back in (van Wijk and Nuij's optimal path, as\n * MapLibre's `flyTo`): long moves stay readable. Pitch and bearing follow the progress. `viewport`: the larger side of\n * the canvas, CSS pixels.\n */\nexport const flyTo = (engine: Target, from: Camera, to: Camera, viewport: number, options: FlyToOptions = {}): Step => {\n const { curve: rho = 1.42, speed = 1.2, easing = defaultEasing } = options;\n const [x0, y0] = toMercator(from.center);\n const [x1, y1] = toMercator(to.center);\n // Across the antimeridian, the short way\n const dx = x1 - x0 - Math.round(x1 - x0);\n const dy = y1 - y0;\n // In pixels at the start zoom (512 px world at zoom 0)\n const world = 512 * 2 ** from.zoom;\n const u1 = Math.hypot(dx, dy) * world;\n const w0 = Math.max(viewport, 1);\n const w1 = w0 / 2 ** (to.zoom - from.zoom);\n const rho2 = rho * rho;\n const r = (i: 0 | 1) => {\n const b = (w1 * w1 - w0 * w0 + (i ? -1 : 1) * rho2 * rho2 * u1 * u1) / (2 * (i ? w1 : w0) * rho2 * u1);\n\n return Math.log(Math.sqrt(b * b + 1) - b);\n };\n // No move on the ground (or nearly): a plain zoom\n const still = u1 < 1e-6 || !Number.isFinite(r(0)) || !Number.isFinite(r(1));\n const r0 = still ? 0 : r(0);\n const length = still ? Math.abs(Math.log(w1 / w0)) / rho : (r(1) - r0) / rho;\n const width = (s: number) =>\n still ? Math.exp((w1 < w0 ? -1 : 1) * rho * s) : Math.cosh(r0) / Math.cosh(r0 + rho * s);\n const along = (s: number) =>\n still ? 0 : (w0 * ((Math.cosh(r0) * Math.tanh(r0 + rho * s) - Math.sinh(r0)) / rho2)) / u1;\n const duration = options.duration ?? (1000 * length) / speed;\n const turn = ((to.bearing - from.bearing + 540) % 360) - 180;\n const start = performance.now();\n\n return (now) => {\n if (now - start >= duration) engine().clearPreload();\n\n const t = duration > 0 ? Math.min(1, (now - start) / duration) : 1;\n const k = easing(t);\n const s = k * length;\n const u = t >= 1 ? 1 : along(s);\n const zoom = t >= 1 ? to.zoom : from.zoom + Math.log2(1 / width(s));\n const [lon, lat] = fromMercator([x0 + dx * u, y0 + dy * u]);\n\n engine().setCamera(lon, lat, zoom, from.pitch + (to.pitch - from.pitch) * k, from.bearing + turn * k);\n\n return t < 1;\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"animation.js","sourceRoot":"","sources":["../../src/util/animation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAQlC,mEAAmE;AACnE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAS,EAAU,EAAE;IACjD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAE5C,gEAAgE;IAChE,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CA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,GAAG,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;QAE5D,MAAM,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC;QAEtG,OAAO,CAAC,GAAG,CAAC,CAAC;IACf,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n * Camera animations: each is a step run every frame by the map (`GeoMap.animate`) until it returns false, setting the\n * camera of the engine in use at that frame (it may be replaced during a flight).\n */\n\nimport type { AnimationOptions, FlyToOptions } from '../types.ts';\nimport type { Camera, Engine } from '../wasm/isard_webgpu.js';\nimport { fromMercator, toMercator } from './geo.ts';\nimport { clamp } from './math.ts';\n\n/** A step of an animation, at `now` (milliseconds, the frame's time): false once done */\nexport type Step = (now: number) => boolean;\n\n/** What a step needs of the engine, read at each frame */\ntype Target = () => Pick<Engine, 'setCamera' | 'clearPreload'>;\n\n/** MapLibre's default easing: cubic Bézier (0.25, 0.1, 0.25, 1) */\nexport const defaultEasing = (t: number): number => {\n if (t <= 0 || t >= 1) return clamp(t, 0, 1);\n\n // Solve x(u) = t for the curve parameter, Newton then bisection\n const [x1, y1, x2, y2] = [0.25, 0.1, 0.25, 1];\n const bezier = (u: number, a: number, b: number) => 3 * a * u * (1 - u) ** 2 + 3 * b * u * u * (1 - u) + u ** 3;\n let u = t;\n\n for (let i = 0; i < 8; i += 1) {\n const x = bezier(u, x1, x2) - t;\n const dx = 3 * x1 * (1 - u) ** 2 + 6 * (x2 - x1) * u * (1 - u) + 3 * (1 - x2) * u * u;\n\n if (Math.abs(x) < 1e-6 || dx === 0) break;\n u = clamp(u - x / dx, 0, 1);\n }\n\n return bezier(u, y1, y2);\n};\n\n/** The step of an animated move from `from` to `to`: over `duration` milliseconds (or the options), ease-out by\n * default, the bearing turning the shortest way round */\nexport const easeTo = (engine: Target, from: Camera, to: Camera, options: number | AnimationOptions = 600): Step => {\n const { duration = 600, easing = (t: number) => 1 - (1 - t) ** 3 } =\n typeof options === 'number' ? { duration: options } : options;\n // Shortest way round\n const turn = ((to.bearing - from.bearing + 540) % 360) - 180;\n const start = performance.now();\n\n return (now) => {\n if (now - start >= duration) engine().clearPreload();\n\n const t = duration > 0 ? Math.min(1, (now - start) / duration) : 1;\n const k = easing(t);\n const mix = (a: number, b: number) => a + (b - a) * k;\n\n engine().setCamera(\n mix(from.center[0], to.center[0]),\n mix(from.center[1], to.center[1]),\n mix(from.zoom, to.zoom),\n mix(from.pitch, to.pitch),\n from.bearing + turn * k,\n );\n\n return t < 1;\n };\n};\n\n/**\n * The step of a flight from `from` to `to` that zooms out on its way and back in (van Wijk and Nuij's optimal path, as\n * MapLibre's `flyTo`): long moves stay readable. Pitch and bearing follow the progress. `viewport`: the larger side of\n * the canvas, CSS pixels.\n */\nexport const flyTo = (engine: Target, from: Camera, to: Camera, viewport: number, options: FlyToOptions = {}): Step => {\n const { curve: rho = 1.42, speed = 1.2, easing = defaultEasing } = options;\n const [x0, y0] = toMercator(from.center);\n const [x1, y1] = toMercator(to.center);\n // Across the antimeridian, the short way\n const dx = x1 - x0 - Math.round(x1 - x0);\n const dy = y1 - y0;\n // In pixels at the start zoom (512 px world at zoom 0)\n const world = 512 * 2 ** from.zoom;\n const u1 = Math.hypot(dx, dy) * world;\n const w0 = Math.max(viewport, 1);\n const w1 = w0 / 2 ** (to.zoom - from.zoom);\n const rho2 = rho * rho;\n const r = (i: 0 | 1) => {\n const b = (w1 * w1 - w0 * w0 + (i ? -1 : 1) * rho2 * rho2 * u1 * u1) / (2 * (i ? w1 : w0) * rho2 * u1);\n\n return Math.log(Math.sqrt(b * b + 1) - b);\n };\n // No move on the ground (or nearly): a plain zoom\n const still = u1 < 1e-6 || !Number.isFinite(r(0)) || !Number.isFinite(r(1));\n const r0 = still ? 0 : r(0);\n const length = still ? Math.abs(Math.log(w1 / w0)) / rho : (r(1) - r0) / rho;\n const width = (s: number) =>\n still ? Math.exp((w1 < w0 ? -1 : 1) * rho * s) : Math.cosh(r0) / Math.cosh(r0 + rho * s);\n const along = (s: number) =>\n still ? 0 : (w0 * ((Math.cosh(r0) * Math.tanh(r0 + rho * s) - Math.sinh(r0)) / rho2)) / u1;\n const duration = options.duration ?? (1000 * length) / speed;\n const turn = ((to.bearing - from.bearing + 540) % 360) - 180;\n const start = performance.now();\n\n return (now) => {\n if (now - start >= duration) engine().clearPreload();\n\n const t = duration > 0 ? Math.min(1, (now - start) / duration) : 1;\n const k = easing(t);\n const s = k * length;\n const u = t >= 1 ? 1 : along(s);\n const zoom = t >= 1 ? to.zoom : from.zoom + Math.log2(1 / width(s));\n const [lon, lat] = fromMercator([x0 + dx * u, y0 + dy * u]);\n\n engine().setCamera(lon, lat, zoom, from.pitch + (to.pitch - from.pitch) * k, from.bearing + turn * k);\n\n return t < 1;\n };\n};\n"]}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A primitive of a tile decoded by `decodeTile`: vertices x, y, z, u, v around the anchor; the image still encoded,
|
|
6
|
+
* the same array for the primitives sharing it
|
|
7
|
+
*/
|
|
8
|
+
export interface EncodedPrimitive {
|
|
9
|
+
vertices: Float32Array<ArrayBuffer>;
|
|
10
|
+
indices: Uint32Array<ArrayBuffer>;
|
|
11
|
+
image?: Uint8Array<ArrayBuffer>;
|
|
12
|
+
mime?: string;
|
|
13
|
+
/** Base color factor of its material (RGBA 0-1), when not white */
|
|
14
|
+
color?: Float32Array<ArrayBuffer>;
|
|
15
|
+
/** The feature of each vertex (`EncodedTile.properties` index them), when the tile has features */
|
|
16
|
+
features?: Float32Array<ArrayBuffer>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** A tile decoded by `decodeTile` */
|
|
20
|
+
export interface EncodedTile {
|
|
21
|
+
/** ECEF origin of the vertices (metres) */
|
|
22
|
+
anchor: Float64Array<ArrayBuffer>;
|
|
23
|
+
primitives: EncodedPrimitive[];
|
|
24
|
+
/** Its points (`.pnts`, glTF points), 20 bytes a vertex: x, y, z (f32) around the anchor, RGB, a normal */
|
|
25
|
+
points: Uint8Array<ArrayBuffer>[];
|
|
26
|
+
/** The properties of its features, one object per feature */
|
|
27
|
+
properties?: Record<string, unknown>[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** A texture transcoded for the GPU (KTX2 / Basis Universal): a WebGL internal format and its mip levels */
|
|
31
|
+
export interface CompressedTexture {
|
|
32
|
+
/** WebGL internal format (compressed, or RGBA8 when the GPU supports none of the targets) */
|
|
33
|
+
format: number;
|
|
34
|
+
levels: { width: number; height: number; data: Uint8Array<ArrayBuffer> }[];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A primitive ready for the GPU: its image decoded (bitmap) or transcoded (texture); primitives given the same bitmap
|
|
39
|
+
* or texture object share one GPU texture
|
|
40
|
+
*/
|
|
41
|
+
export interface DecodedPrimitive {
|
|
42
|
+
vertices: Float32Array<ArrayBuffer>;
|
|
43
|
+
indices: Uint32Array<ArrayBuffer>;
|
|
44
|
+
bitmap: ImageBitmap | null;
|
|
45
|
+
texture?: CompressedTexture;
|
|
46
|
+
/** Base color factor of its material (RGBA 0-1), when not white */
|
|
47
|
+
color?: Float32Array<ArrayBuffer>;
|
|
48
|
+
/** The feature of each vertex, when the tile has features */
|
|
49
|
+
features?: Float32Array<ArrayBuffer>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A Draco-compressed primitive of a tile (`KHR_draco_mesh_compression`), or its points
|
|
54
|
+
* (`3DTILES_draco_point_compression`), to decode with the Draco module
|
|
55
|
+
*/
|
|
56
|
+
export interface DracoRequest {
|
|
57
|
+
mesh: number;
|
|
58
|
+
primitive: number;
|
|
59
|
+
data: Uint8Array<ArrayBuffer>;
|
|
60
|
+
/** Draco attribute ids */
|
|
61
|
+
position: number;
|
|
62
|
+
uv?: number;
|
|
63
|
+
color?: number;
|
|
64
|
+
normal?: number;
|
|
65
|
+
/** A point cloud: no triangles */
|
|
66
|
+
points?: boolean;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** The Draco module's output for a request: positions, uv, colors and normals as stored, triangles (not for points) */
|
|
70
|
+
export interface DracoGeometry {
|
|
71
|
+
mesh: number;
|
|
72
|
+
primitive: number;
|
|
73
|
+
positions: Float32Array;
|
|
74
|
+
uvs?: Float32Array;
|
|
75
|
+
indices?: Uint32Array;
|
|
76
|
+
colors?: Float32Array;
|
|
77
|
+
normals?: Float32Array;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Compressed texture formats supported by the GPU */
|
|
81
|
+
export interface TextureFormats {
|
|
82
|
+
astc: boolean;
|
|
83
|
+
bptc: boolean;
|
|
84
|
+
etc: boolean;
|
|
85
|
+
s3tc: boolean;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** A tile ready for the GPU, as the decoding workers deliver it */
|
|
89
|
+
export interface DecodedTile {
|
|
90
|
+
anchor: Float64Array<ArrayBuffer>;
|
|
91
|
+
primitives: DecodedPrimitive[];
|
|
92
|
+
/** Its points' vertices (`EncodedTile.points`) */
|
|
93
|
+
points?: Uint8Array<ArrayBuffer>[];
|
|
94
|
+
/** The properties of its features (`EncodedTile.properties`) */
|
|
95
|
+
properties?: Record<string, unknown>[];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** What the engine expects from a pool of decoding workers (`Engine.setTileLoader`) */
|
|
99
|
+
export interface TileLoaderLike {
|
|
100
|
+
/**
|
|
101
|
+
* `reload`: bypass the HTTP cache (the tile failed before: the cache may hold the error); `priority`: the Fetch
|
|
102
|
+
* Priority for the download (the first tiles in view of a frame are urgent)
|
|
103
|
+
*/
|
|
104
|
+
load(
|
|
105
|
+
id: number,
|
|
106
|
+
url: string,
|
|
107
|
+
transform: Float64Array,
|
|
108
|
+
yUp: boolean,
|
|
109
|
+
reload: boolean,
|
|
110
|
+
priority?: 'high' | 'low',
|
|
111
|
+
): Promise<DecodedTile>;
|
|
112
|
+
abort(id: number): void;
|
|
113
|
+
/**
|
|
114
|
+
* The points of a COPC node: its LAZ chunk (`size` bytes at `offset` of the file at `url`, a range request), the
|
|
115
|
+
* data of the file's LAZ VLR, its layout (format, record length, scale, offset), the grid positioning its points
|
|
116
|
+
* and its point count; resolves with its vertices (20 bytes each, see `EncodedTile.points`)
|
|
117
|
+
*/
|
|
118
|
+
loadPoints?(
|
|
119
|
+
id: number,
|
|
120
|
+
url: string,
|
|
121
|
+
offset: number,
|
|
122
|
+
size: number,
|
|
123
|
+
laz: Uint8Array,
|
|
124
|
+
layout: Float64Array,
|
|
125
|
+
grid: Float64Array,
|
|
126
|
+
count: number,
|
|
127
|
+
priority?: 'high' | 'low',
|
|
128
|
+
): Promise<Uint8Array<ArrayBuffer>>;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Decodes a `.b3dm` / `.pnts` / `.glb` tile: `{ anchor: Float64Array(3), primitives: [{ vertices: Float32Array (x,
|
|
135
|
+
* y, z, u, v per vertex, relative to the anchor), indices: Uint32Array, image?: Uint8Array, mime?: string, color?:
|
|
136
|
+
* Float32Array (the material's base color, when not white) }], points: [Uint8Array] (the points' vertices) }`.
|
|
137
|
+
* `transform`: the tile's world transform (16 numbers, column-major).
|
|
138
|
+
* `draco`: the decoded geometries of its Draco primitives (`dracoRequests`), if any.
|
|
139
|
+
*/
|
|
140
|
+
export function decodeTile(bytes: Uint8Array, transform: Float64Array, y_up: boolean, draco: DracoGeometry[] | undefined): EncodedTile;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The Draco-compressed primitives of a tile, to decode before `decodeTile`
|
|
144
|
+
*/
|
|
145
|
+
export function dracoRequests(bytes: Uint8Array): DracoRequest[];
|
|
146
|
+
|
|
147
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
148
|
+
|
|
149
|
+
export interface InitOutput {
|
|
150
|
+
readonly memory: WebAssembly.Memory;
|
|
151
|
+
readonly decodeTile: (a: number, b: number, c: number, d: number, e: number, f: any) => [number, number, number];
|
|
152
|
+
readonly dracoRequests: (a: number, b: number) => [number, number, number];
|
|
153
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
154
|
+
readonly __externref_table_alloc: () => number;
|
|
155
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
156
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
157
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
158
|
+
readonly __wbindgen_start: () => void;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
165
|
+
* a precompiled `WebAssembly.Module`.
|
|
166
|
+
*
|
|
167
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
168
|
+
*
|
|
169
|
+
* @returns {InitOutput}
|
|
170
|
+
*/
|
|
171
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
175
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
176
|
+
*
|
|
177
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
178
|
+
*
|
|
179
|
+
* @returns {Promise<InitOutput>}
|
|
180
|
+
*/
|
|
181
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|