isard 1.1.0 → 1.2.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.
Files changed (216) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/basemap/basemaps.d.ts +1 -1
  3. package/dist/basemap/basemaps.js +2 -2
  4. package/dist/basemap/basemaps.js.map +1 -1
  5. package/dist/basemap/grid.d.ts +5 -5
  6. package/dist/basemap/grid.js +59 -65
  7. package/dist/basemap/grid.js.map +1 -1
  8. package/dist/basemap/mvt.d.ts +1 -1
  9. package/dist/basemap/mvt.js +6 -6
  10. package/dist/basemap/mvt.js.map +1 -1
  11. package/dist/basemap/pmtiles.d.ts +10 -10
  12. package/dist/basemap/pmtiles.js +39 -31
  13. package/dist/basemap/pmtiles.js.map +1 -1
  14. package/dist/basemap/resample.d.ts +2 -2
  15. package/dist/basemap/resample.js +16 -14
  16. package/dist/basemap/resample.js.map +1 -1
  17. package/dist/basemap/terrain.d.ts +3 -3
  18. package/dist/basemap/terrain.js +6 -6
  19. package/dist/basemap/terrain.js.map +1 -1
  20. package/dist/basemap/vectorstyle.d.ts +12 -10
  21. package/dist/basemap/vectorstyle.js +128 -110
  22. package/dist/basemap/vectorstyle.js.map +1 -1
  23. package/dist/basemap/vectortiles.d.ts +11 -11
  24. package/dist/basemap/vectortiles.js +141 -103
  25. package/dist/basemap/vectortiles.js.map +1 -1
  26. package/dist/basemap/wmts.d.ts +3 -3
  27. package/dist/basemap/wmts.js +16 -11
  28. package/dist/basemap/wmts.js.map +1 -1
  29. package/dist/basemap.worker.js +2 -2
  30. package/dist/basemap.worker.js.map +14 -13
  31. package/dist/bind/layers.d.ts +13 -4
  32. package/dist/bind/layers.js +64 -40
  33. package/dist/bind/layers.js.map +1 -1
  34. package/dist/data/crs.d.ts +10 -10
  35. package/dist/data/crs.js +38 -34
  36. package/dist/data/crs.js.map +1 -1
  37. package/dist/data/gpx.d.ts +1 -1
  38. package/dist/data/gpx.js +20 -20
  39. package/dist/data/gpx.js.map +1 -1
  40. package/dist/data/kml.d.ts +1 -1
  41. package/dist/data/kml.js +42 -39
  42. package/dist/data/kml.js.map +1 -1
  43. package/dist/data/topojson.d.ts +1 -1
  44. package/dist/data/topojson.js +15 -10
  45. package/dist/data/topojson.js.map +1 -1
  46. package/dist/data/xml.d.ts +5 -5
  47. package/dist/data/xml.js +19 -18
  48. package/dist/data/xml.js.map +1 -1
  49. package/dist/decoder.worker.js +4 -4
  50. package/dist/decoder.worker.js.map +6 -6
  51. package/dist/engine/decoders.d.ts +2 -2
  52. package/dist/engine/decoders.js +28 -25
  53. package/dist/engine/decoders.js.map +1 -1
  54. package/dist/engine/loader.js +13 -14
  55. package/dist/engine/loader.js.map +1 -1
  56. package/dist/engine/requests.d.ts +1 -1
  57. package/dist/engine/requests.js +19 -16
  58. package/dist/engine/requests.js.map +1 -1
  59. package/dist/engine-loader.d.ts +8 -8
  60. package/dist/engine-loader.js +27 -27
  61. package/dist/engine-loader.js.map +1 -1
  62. package/dist/geoplateforme.d.ts +10 -10
  63. package/dist/geoplateforme.js +22 -20
  64. package/dist/geoplateforme.js.map +1 -1
  65. package/dist/index.d.ts +1 -0
  66. package/dist/index.js.map +1 -1
  67. package/dist/isard_bg.wasm +0 -0
  68. package/dist/isard_core_bg.wasm +0 -0
  69. package/dist/isard_points_bg.wasm +0 -0
  70. package/dist/layers/extrusions.d.ts +1 -1
  71. package/dist/layers/extrusions.js +10 -5
  72. package/dist/layers/extrusions.js.map +1 -1
  73. package/dist/layers/features.d.ts +10 -10
  74. package/dist/layers/features.js +41 -42
  75. package/dist/layers/features.js.map +1 -1
  76. package/dist/layers/glyphs.d.ts +3 -3
  77. package/dist/layers/glyphs.js +34 -40
  78. package/dist/layers/glyphs.js.map +1 -1
  79. package/dist/layers/icons.d.ts +8 -8
  80. package/dist/layers/icons.js +76 -68
  81. package/dist/layers/icons.js.map +1 -1
  82. package/dist/layers/layers.d.ts +1 -1
  83. package/dist/layers/layers.js +33 -29
  84. package/dist/layers/layers.js.map +1 -1
  85. package/dist/layers/panoramas.d.ts +2 -2
  86. package/dist/layers/panoramas.js +52 -41
  87. package/dist/layers/panoramas.js.map +1 -1
  88. package/dist/layers/pointclouds.d.ts +3 -3
  89. package/dist/layers/pointclouds.js +25 -33
  90. package/dist/layers/pointclouds.js.map +1 -1
  91. package/dist/layers/symbols.d.ts +1 -1
  92. package/dist/layers/symbols.js +68 -71
  93. package/dist/layers/symbols.js.map +1 -1
  94. package/dist/map/basemap-layers.d.ts +26 -0
  95. package/dist/map/basemap-layers.js +61 -0
  96. package/dist/map/basemap-layers.js.map +1 -0
  97. package/dist/map/canvas.d.ts +17 -0
  98. package/dist/map/canvas.js +56 -0
  99. package/dist/map/canvas.js.map +1 -0
  100. package/dist/map/checks.d.ts +11 -0
  101. package/dist/map/checks.js +39 -0
  102. package/dist/map/checks.js.map +1 -0
  103. package/dist/map/credits.d.ts +17 -0
  104. package/dist/map/credits.js +34 -0
  105. package/dist/map/credits.js.map +1 -0
  106. package/dist/map/engine-settings.d.ts +15 -0
  107. package/dist/map/engine-settings.js +45 -0
  108. package/dist/map/engine-settings.js.map +1 -0
  109. package/dist/map/engines.d.ts +41 -0
  110. package/dist/map/engines.js +77 -0
  111. package/dist/map/engines.js.map +1 -0
  112. package/dist/map/events.d.ts +14 -0
  113. package/dist/map/events.js +46 -0
  114. package/dist/map/events.js.map +1 -0
  115. package/dist/map/frame-loop.d.ts +61 -0
  116. package/dist/map/frame-loop.js +139 -0
  117. package/dist/map/frame-loop.js.map +1 -0
  118. package/dist/map/hover-pick.d.ts +30 -0
  119. package/dist/map/hover-pick.js +56 -0
  120. package/dist/map/hover-pick.js.map +1 -0
  121. package/dist/map/layer-spec.d.ts +42 -0
  122. package/dist/map/layer-spec.js +34 -0
  123. package/dist/map/layer-spec.js.map +1 -0
  124. package/dist/map/layer-stack.d.ts +36 -0
  125. package/dist/map/layer-stack.js +101 -0
  126. package/dist/map/layer-stack.js.map +1 -0
  127. package/dist/map/overlay-host.d.ts +36 -0
  128. package/dist/map/overlay-host.js +101 -0
  129. package/dist/map/overlay-host.js.map +1 -0
  130. package/dist/map/panorama-host.d.ts +5 -0
  131. package/dist/map/panorama-host.js +32 -0
  132. package/dist/map/panorama-host.js.map +1 -0
  133. package/dist/map/raster-source.d.ts +11 -0
  134. package/dist/map/raster-source.js +26 -0
  135. package/dist/map/raster-source.js.map +1 -0
  136. package/dist/map/symbol-atlases.d.ts +26 -0
  137. package/dist/map/symbol-atlases.js +59 -0
  138. package/dist/map/symbol-atlases.js.map +1 -0
  139. package/dist/map/viewshed.d.ts +5 -0
  140. package/dist/map/viewshed.js +28 -0
  141. package/dist/map/viewshed.js.map +1 -0
  142. package/dist/map/workers.d.ts +46 -0
  143. package/dist/map/workers.js +73 -0
  144. package/dist/map/workers.js.map +1 -0
  145. package/dist/map.d.ts +33 -120
  146. package/dist/map.js +164 -689
  147. package/dist/map.js.map +1 -1
  148. package/dist/react/Control.d.ts +11 -0
  149. package/dist/react/Control.js +18 -0
  150. package/dist/react/Control.js.map +1 -0
  151. package/dist/react/CustomLayer.d.ts +11 -0
  152. package/dist/react/CustomLayer.js +30 -0
  153. package/dist/react/CustomLayer.js.map +1 -0
  154. package/dist/react/IsardMap.d.ts +43 -0
  155. package/dist/react/IsardMap.js +146 -0
  156. package/dist/react/IsardMap.js.map +1 -0
  157. package/dist/react/Layer.d.ts +42 -0
  158. package/dist/react/Layer.js +74 -0
  159. package/dist/react/Layer.js.map +1 -0
  160. package/dist/react/Marker.d.ts +24 -0
  161. package/dist/react/Marker.js +53 -0
  162. package/dist/react/Marker.js.map +1 -0
  163. package/dist/react/Panel.d.ts +11 -0
  164. package/dist/react/Panel.js +37 -0
  165. package/dist/react/Panel.js.map +1 -0
  166. package/dist/react/Popup.d.ts +18 -0
  167. package/dist/react/Popup.js +60 -0
  168. package/dist/react/Popup.js.map +1 -0
  169. package/dist/react/Swipe.d.ts +9 -0
  170. package/dist/react/Swipe.js +41 -0
  171. package/dist/react/Swipe.js.map +1 -0
  172. package/dist/react/Viewshed.d.ts +5 -0
  173. package/dist/react/Viewshed.js +28 -0
  174. package/dist/react/Viewshed.js.map +1 -0
  175. package/dist/react/context.d.ts +32 -0
  176. package/dist/react/context.js +20 -0
  177. package/dist/react/context.js.map +1 -0
  178. package/dist/react/index.d.ts +15 -108
  179. package/dist/react/index.js +10 -397
  180. package/dist/react/index.js.map +1 -1
  181. package/dist/settings.d.ts +5 -9
  182. package/dist/settings.js +17 -15
  183. package/dist/settings.js.map +1 -1
  184. package/dist/types.d.ts +3 -3
  185. package/dist/types.js.map +1 -1
  186. package/dist/ui/controls.js +6 -4
  187. package/dist/ui/controls.js.map +1 -1
  188. package/dist/ui/interaction.d.ts +2 -2
  189. package/dist/ui/interaction.js +8 -7
  190. package/dist/ui/interaction.js.map +1 -1
  191. package/dist/ui/overlay.js +18 -20
  192. package/dist/ui/overlay.js.map +1 -1
  193. package/dist/ui/style.d.ts +1 -1
  194. package/dist/ui/style.js +2 -2
  195. package/dist/ui/style.js.map +1 -1
  196. package/dist/util/animation.d.ts +3 -3
  197. package/dist/util/animation.js +6 -6
  198. package/dist/util/animation.js.map +1 -1
  199. package/dist/util/color.d.ts +1 -1
  200. package/dist/util/color.js +14 -16
  201. package/dist/util/color.js.map +1 -1
  202. package/dist/util/geo.d.ts +6 -6
  203. package/dist/util/geo.js +12 -12
  204. package/dist/util/geo.js.map +1 -1
  205. package/dist/util/guards.d.ts +7 -0
  206. package/dist/util/guards.js +8 -0
  207. package/dist/util/guards.js.map +1 -0
  208. package/dist/util/lru.js.map +1 -1
  209. package/dist/wasm/isard.d.ts +168 -0
  210. package/dist/wasm/isard.js +146 -0
  211. package/dist/wasm/isard_core.d.ts +144 -0
  212. package/dist/wasm/isard_core.js +122 -0
  213. package/dist/workers/basemap.worker.d.ts +3 -3
  214. package/dist/workers/basemap.worker.js +94 -83
  215. package/dist/workers/basemap.worker.js.map +1 -1
  216. package/package.json +1 -1
@@ -1 +1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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;YACzG,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;YACjE,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 } from '../util/geo.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/** 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 function 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 function 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 const b = (camera.bearing * Math.PI) / 180;\n const [sx, sy] = [action.pan[0], action.pan[1] / Math.max(0.25, Math.cos((camera.pitch * Math.PI) / 180))];\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 = Math.max(0, Math.min(1, mercatorY(lat) + dy));\n const wrapped = ((((x * 360) % 360) + 360) % 360) - 180;\n return { center: [wrapped, latitude(y)] };\n}\n\n/** An element that takes the keys typed in it */\nfunction editable(target: EventTarget | null): boolean {\n if (!(target instanceof HTMLElement)) return false;\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}\n\nexport class Interaction {\n private readonly pointers = new Map<number, Pointer>();\n private readonly cleanup: (() => void)[] = [];\n private wheel = { pending: 0, at: [0, 0] as Point };\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\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 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 // 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 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 container.addEventListener('keydown', key);\n this.cleanup.push(() => container.removeEventListener('keydown', key));\n }\n }\n\n destroy(): void {\n for (const off of this.cleanup) off();\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 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 const point = this.local(e);\n const rotate = e.button === 2 || e.ctrlKey || e.shiftKey;\n this.pointers.set(e.pointerId, { point, start: point, button: e.button, rotate });\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 if (!p) {\n if (e.pointerType === 'mouse') this.map.hover(point);\n return;\n }\n const [dx, dy] = [point[0] - p.point[0], point[1] - p.point[1]];\n if (Math.hypot(point[0] - p.start[0], point[1] - p.start[1]) > CLICK_TOLERANCE) this.moved = true;\n const eye = this.map.firstPerson;\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 this.map.setFirstPerson({ ...eye, bearing: eye.bearing - dx * degrees, pitch: eye.pitch + dy * degrees });\n p.point = point;\n return;\n }\n const engine = this.map.engine;\n const other = [...this.pointers.values()].find((q) => q !== p);\n if (this.pointers.size === 2 && other) {\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 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 (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 if (!p) return;\n this.pointers.delete(e.pointerId);\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 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 if (!first || recent.length < 2) return;\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 if (Math.hypot(vx, vy) < 0.1) return;\n let last = performance.now();\n let point = from;\n this.map.animate((t) => {\n const dt = Math.min(64, t - last);\n last = t;\n const decay = Math.exp(-dt / INERTIA_DECAY);\n const next: Point = [point[0] + vx * dt, point[1] + vy * dt];\n this.map.engine.pan(point[0], point[1], next[0], next[1]);\n point = next;\n vx *= decay;\n vy *= decay;\n return Math.hypot(vx, vy) > 0.02;\n });\n }\n\n private onWheel(e: WheelEvent): void {\n e.preventDefault();\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 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 return;\n }\n this.zoomBy(\n Math.max(-1, Math.min(1, -pixels * WHEEL_RATE)),\n this.local(e),\n e.deltaMode === 0 && Math.abs(pixels) < 40,\n );\n }\n\n private onKey(e: KeyboardEvent): void {\n if (e.defaultPrevented || e.ctrlKey || e.metaKey || e.altKey || editable(e.target)) return;\n const action = keyAction(e.key, e.shiftKey);\n if (!action) return;\n e.preventDefault();\n const eye = this.map.firstPerson;\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 if (turn)\n this.map.setFirstPerson({ ...eye, bearing: eye.bearing + (turn[0] ?? 0), pitch: eye.pitch + (turn[1] ?? 0) });\n return;\n }\n this.wheel.pending = 0;\n const reduced = typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches;\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 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 this.wheel.pending -= step;\n this.map.engine.zoomAt(step, this.wheel.at[0], this.wheel.at[1]);\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,MAAM,gBAAgB,CAAC;AAGhE,kFAAkF;AAClF,MAAM,UAAU,GAAG,CAAC,GAAG,GAAG,CAAC;AAC3B,2FAA2F;AAC3F,MAAM,UAAU,GAAG,GAAG,CAAC;AACvB,gEAAgE;AAChE,MAAM,WAAW,GAAG,GAAG,CAAC;AACxB,gEAAgE;AAChE,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,uEAAuE;AACvE,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B,qCAAqC;AACrC,MAAM,OAAO,GAAG,GAAG,CAAC;AACpB,8CAA8C;AAC9C,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,2CAA2C;AAC3C,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,uDAAuD;AACvD,MAAM,YAAY,GAAG,GAAG,CAAC;AAKzB;iEACiE;AACjE,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAW,EAAE,KAAc,EAAyB,EAAE;IAC9E,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,WAAW;YACd,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC;QACpE,KAAK,YAAY;YACf,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC;QAClE,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,S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,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 } from '../util/geo.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/** 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 * Math.PI) / 180;\n const [sx, sy] = [action.pan[0], action.pan[1] / Math.max(0.25, Math.cos((camera.pitch * Math.PI) / 180))];\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 = Math.max(0, Math.min(1, mercatorY(lat) + dy));\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}\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 /** 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\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 });\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 if (this.pointers.size === 2 && other) {\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 (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 // 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(\n Math.max(-1, Math.min(1, -pixels * WHEEL_RATE)),\n this.local(e),\n e.deltaMode === 0 && Math.abs(pixels) < 40,\n );\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"]}
@@ -36,13 +36,14 @@ class Emitter {
36
36
  return () => set.delete(listener);
37
37
  }
38
38
  emit(type, event) {
39
- for (const listener of this.listeners[type] ?? [])
39
+ this.listeners[type]?.forEach((listener) => {
40
40
  listener(event);
41
+ });
41
42
  }
42
43
  }
43
44
  /** Moves `element` so that its anchor sits on `lonLat`, `height` metres above the ground, or hides it when the
44
45
  * position is out of sight; returns the screen point */
45
- function place(map, element, lonLat, height, anchor, offset, size) {
46
+ const place = (map, element, lonLat, height, anchor, offset, size) => {
46
47
  const point = map.project(lonLat, height);
47
48
  const visible = point !== undefined &&
48
49
  point[0] > -MARGIN &&
@@ -59,16 +60,16 @@ function place(map, element, lonLat, height, anchor, offset, size) {
59
60
  const y = Math.round(point[1] + offset[1]);
60
61
  element.style.transform = `translate(${x}px, ${y}px) ${ANCHOR_TRANSLATE[anchor]}`;
61
62
  return point;
62
- }
63
+ };
63
64
  /** Round pin, its tip at the bottom: the default marker */
64
- function pin() {
65
+ const pin = () => {
65
66
  const element = document.createElement('div');
66
67
  element.innerHTML =
67
68
  '<svg class="isard-marker-pin" width="25" height="34" viewBox="0 0 25 34" aria-hidden="true">' +
68
69
  '<path fill="currentColor" stroke="rgb(0 0 0 / 0.25)" d="M12.5 33.5C12.5 33.5 .5 20.6 .5 12.5a12 12 0 0 1 24 0' +
69
70
  'c0 8.1-12 21-12 21z"/><circle cx="12.5" cy="12.5" r="4.5" fill="#fff"/></svg>';
70
71
  return element;
71
- }
72
+ };
72
73
  /** An element at a position on the map, optionally draggable */
73
74
  export class Marker {
74
75
  element;
@@ -176,7 +177,9 @@ export class Marker {
176
177
  addTo(map) {
177
178
  if (this.map === map)
178
179
  return this;
179
- this.remove();
180
+ // From another map: off it first (its popup with it); a popup opened before the marker is added stays open
181
+ if (this.map)
182
+ this.remove();
180
183
  this.map = map;
181
184
  map.attachOverlay(this, this.element);
182
185
  return this;
@@ -391,18 +394,10 @@ export class Popup {
391
394
  }
392
395
  }
393
396
  /** `a × b`, 4 × 4 column-major */
394
- function multiply(a, b) {
395
- const out = new Array(16).fill(0);
396
- for (let c = 0; c < 4; c++) {
397
- for (let r = 0; r < 4; r++) {
398
- let sum = 0;
399
- for (let k = 0; k < 4; k++)
400
- sum += (a[k * 4 + r] ?? 0) * (b[c * 4 + k] ?? 0);
401
- out[c * 4 + r] = sum;
402
- }
403
- }
404
- return out;
405
- }
397
+ const multiply = (a, b) => Array.from({ length: 16 }, (_, i) => {
398
+ const [c, r] = [Math.floor(i / 4), i % 4];
399
+ return [0, 1, 2, 3].reduce((sum, k) => sum + (a[k * 4 + r] ?? 0) * (b[c * 4 + k] ?? 0), 0);
400
+ });
406
401
  /**
407
402
  * An element standing in 3D at a position: a video, a web page, a sign, `width` metres wide on the ground, facing
408
403
  * `heading`. Placed after each frame by a CSS 3D transform (the element is not drawn by WebGL: the scene does not
@@ -457,7 +452,9 @@ export class Panel {
457
452
  addTo(map) {
458
453
  if (this.map === map)
459
454
  return this;
460
- this.remove();
455
+ // From another map: off it first (its popup with it); a popup opened before the marker is added stays open
456
+ if (this.map)
457
+ this.remove();
461
458
  this.map = map;
462
459
  map.attachOverlay(this, this.element);
463
460
  return this;
@@ -504,8 +501,9 @@ export class Panel {
504
501
  // inverted is not drawn
505
502
  const m = multiply(toScreen, clip);
506
503
  m.splice(8, 4, 0, 0, 1, 0);
507
- for (const k of [2, 6, 14])
504
+ [2, 6, 14].forEach((k) => {
508
505
  m[k] = 0;
506
+ });
509
507
  this.element.style.transform = `matrix3d(${m.join(',')})`;
510
508
  }
511
509
  }
@@ -1 +1 @@
1
- {"version":3,"file":"overlay.js","sourceRoot":"","sources":["../../src/ui/overlay.ts"],"names":[],"mappings":"AAoBA,MAAM,gBAAgB,GAA2B;IAC/C,MAAM,EAAE,uBAAuB;IAC/B,GAAG,EAAE,oBAAoB;IACzB,MAAM,EAAE,wBAAwB;IAChC,IAAI,EAAE,oBAAoB;IAC1B,KAAK,EAAE,wBAAwB;IAC/B,UAAU,EAAE,iBAAiB;IAC7B,WAAW,EAAE,qBAAqB;IAClC,aAAa,EAAE,qBAAqB;IACpC,cAAc,EAAE,yBAAyB;CAC1C,CAAC;AAEF,0GAA0G;AAC1G,MAAM,YAAY,GAAqC;IACrD,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,GAAG,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC;IACjB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC;IAClB,KAAK,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;IACtB,UAAU,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;IACtB,WAAW,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC;IAC1B,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF;gEACgE;AAChE,MAAM,MAAM,GAAG,GAAG,CAAC;AACnB,sFAAsF;AACtF,MAAM,cAAc,GAAG,CAAC,CAAC;AAQzB,oCAAoC;AACpC,MAAM,OAAO;IACM,SAAS,GAAoD,EAAE,CAAC;IAEjF,EAAE,CAAoB,IAAO,EAAE,QAA+B;QAC5D,MAAM,GAAG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CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QACtF,yEAAyE;QACzE,IAAI,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,EAAE,CAAC;YACnB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC;YACzC,OAAO;QACT,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,EAAE,CAAC;QACnC,yGAAyG;QACzG,wBAAwB;QACxB,MAAM,CAAC,GAAG,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACnC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3B,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAC5D,CAAC;CACF","sourcesContent":["/**\n * DOM overlays tied to a position: markers and popups. The map places them all in one pass after each frame it draws\n * (camera moves, finer relief arriving), with a CSS transform from `map.project`: the browser only composites them,\n * nothing is laid out again.\n */\nimport type { GeoMap } from '../map.ts';\nimport type { LonLat, Point } from '../types.ts';\n\n/** Which part of the element sits on the position */\nexport type Anchor =\n | 'center'\n | 'top'\n | 'bottom'\n | 'left'\n | 'right'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right';\n\nconst ANCHOR_TRANSLATE: Record<Anchor, string> = {\n center: 'translate(-50%, -50%)',\n top: 'translate(-50%, 0)',\n bottom: 'translate(-50%, -100%)',\n left: 'translate(0, -50%)',\n right: 'translate(-100%, -50%)',\n 'top-left': 'translate(0, 0)',\n 'top-right': 'translate(-100%, 0)',\n 'bottom-left': 'translate(0, -100%)',\n 'bottom-right': 'translate(-100%, -100%)',\n};\n\n/** Where the anchor lies within the element, CSS percentages: the stem of a raised marker starts there */\nconst ANCHOR_POINT: Record<Anchor, [string, string]> = {\n center: ['50%', '50%'],\n top: ['50%', '0'],\n bottom: ['50%', '100%'],\n left: ['0', '50%'],\n right: ['100%', '50%'],\n 'top-left': ['0', '0'],\n 'top-right': ['100%', '0'],\n 'bottom-left': ['0', '100%'],\n 'bottom-right': ['100%', '100%'],\n};\n\n/** Overlays further than this out of the canvas (CSS pixels) are hidden: no part of them can show, and huge\n * transforms near the horizon would only cost the compositor */\nconst MARGIN = 500;\n/** A press on a draggable marker that moves less than this (CSS pixels) is a click */\nconst DRAG_TOLERANCE = 3;\n\n/** @internal What the map places after each frame */\nexport interface Positioned {\n /** Places the overlay for the current camera; `size` is the canvas size in CSS pixels */\n position(size: Point): void;\n}\n\n/** Typed listeners of an overlay */\nclass Emitter<E> {\n private readonly listeners: { [K in keyof E]?: Set<(event: E[K]) => void> } = {};\n\n on<K extends keyof E>(type: K, listener: (event: E[K]) => void): () => void {\n const set = this.listeners[type] ?? new Set();\n this.listeners[type] = set;\n set.add(listener);\n return () => set.delete(listener);\n }\n\n emit<K extends keyof E>(type: K, event: E[K]): void {\n for (const listener of this.listeners[type] ?? []) listener(event);\n }\n}\n\n/** Moves `element` so that its anchor sits on `lonLat`, `height` metres above the ground, or hides it when the\n * position is out of sight; returns the screen point */\nfunction place(\n map: GeoMap,\n element: HTMLElement,\n lonLat: LonLat,\n height: number,\n anchor: Anchor,\n offset: Point,\n size: Point,\n): Point | undefined {\n const point = map.project(lonLat, height);\n const visible =\n point !== undefined &&\n point[0] > -MARGIN &&\n point[0] < size[0] + MARGIN &&\n point[1] > -MARGIN &&\n point[1] < size[1] + MARGIN;\n if (!visible) {\n element.style.display = 'none';\n return undefined;\n }\n element.style.display = '';\n // Whole pixels: a fractional translation blurs text and icons\n const x = Math.round(point[0] + offset[0]);\n const y = Math.round(point[1] + offset[1]);\n element.style.transform = `translate(${x}px, ${y}px) ${ANCHOR_TRANSLATE[anchor]}`;\n return point;\n}\n\n/** Round pin, its tip at the bottom: the default marker */\nfunction pin(): HTMLElement {\n const element = document.createElement('div');\n element.innerHTML =\n '<svg class=\"isard-marker-pin\" width=\"25\" height=\"34\" viewBox=\"0 0 25 34\" aria-hidden=\"true\">' +\n '<path fill=\"currentColor\" stroke=\"rgb(0 0 0 / 0.25)\" d=\"M12.5 33.5C12.5 33.5 .5 20.6 .5 12.5a12 12 0 0 1 24 0' +\n 'c0 8.1-12 21-12 21z\"/><circle cx=\"12.5\" cy=\"12.5\" r=\"4.5\" fill=\"#fff\"/></svg>';\n return element;\n}\n\nexport interface MarkerOptions {\n /** The element to show (default: a round pin) */\n element?: HTMLElement;\n /** Which part of the element sits on the position (default 'center' with an element of your own, 'bottom' for the\n * default pin) */\n anchor?: Anchor;\n /** Shift from the anchor, CSS pixels (default [0, 0]) */\n offset?: Point;\n /** The marker can be dragged over the map, on the relief (default false) */\n draggable?: boolean;\n /** Metres above the ground (default 0): a raised marker has a stem down to its position on the ground */\n height?: number;\n /** Classes added to the element, space separated */\n className?: string;\n}\n\nexport interface MarkerEvent {\n target: Marker;\n lonLat: LonLat;\n}\n\nexport interface MarkerEvents {\n dragstart: MarkerEvent;\n drag: MarkerEvent;\n dragend: MarkerEvent;\n}\n\n/** An element at a position on the map, optionally draggable */\nexport class Marker {\n private readonly element: HTMLElement;\n private readonly anchor: Anchor;\n private readonly events = new Emitter<MarkerEvents>();\n private offset: Point;\n private draggable: boolean;\n private lonLat: LonLat = [0, 0];\n private height: number;\n /** Metres above the ground of what the marker stands on, where its stem ends */\n private base = 0;\n /** The line from a raised marker down to the ground */\n private readonly stem: HTMLElement;\n private map: GeoMap | undefined;\n private popup: Popup | undefined;\n /** While pressed: the press point and the gap between the pointer and the marker's position */\n private grab: { start: Point; gap: Point } | undefined;\n private dragging = false;\n /** The click that ends a drag is not a click on the marker */\n private swallowClick = false;\n\n constructor(options: MarkerOptions = {}) {\n this.element = options.element ?? pin();\n this.anchor = options.anchor ?? (options.element ? 'center' : 'bottom');\n this.offset = options.offset ?? [0, 0];\n this.draggable = options.draggable ?? false;\n this.height = options.height ?? 0;\n this.stem = document.createElement('div');\n this.stem.className = 'isard-marker-stem';\n [this.stem.style.left, this.stem.style.top] = ANCHOR_POINT[this.anchor];\n this.element.append(this.stem);\n this.element.classList.add('isard-marker');\n if (options.className) this.element.classList.add(...options.className.split(/\\s+/).filter(Boolean));\n this.element.classList.toggle('isard-marker-draggable', this.draggable);\n this.element.addEventListener('pointerdown', (e) => this.down(e));\n this.element.addEventListener('pointermove', (e) => this.move(e));\n this.element.addEventListener('pointerup', (e) => this.up(e));\n this.element.addEventListener('pointercancel', (e) => this.up(e));\n this.element.addEventListener('click', (e) => this.click(e), { capture: true });\n }\n\n getElement(): HTMLElement {\n return this.element;\n }\n\n getLonLat(): LonLat {\n return [...this.lonLat];\n }\n\n setLonLat(lonLat: LonLat): this {\n this.lonLat = [lonLat[0], lonLat[1]];\n this.map?.positionOverlay(this);\n // An open popup of the marker goes with it\n if (this.popup?.isOpen()) this.popup.setLonLat(this.lonLat);\n return this;\n }\n\n getHeight(): number {\n return this.height;\n }\n\n /** Metres above the ground: a raised marker has a stem down to `base` metres, what it stands on (a roof, a mesh;\n * the ground by default); its popup is raised too */\n setHeight(height: number, base = 0): this {\n this.height = Number.isFinite(height) ? height : 0;\n this.base = Number.isFinite(base) ? Math.min(base, this.height) : 0;\n this.popup?.setHeight(this.height);\n this.map?.positionOverlay(this);\n return this;\n }\n\n setOffset(offset: Point): this {\n this.offset = [offset[0], offset[1]];\n this.map?.positionOverlay(this);\n return this;\n }\n\n setDraggable(draggable: boolean): this {\n this.draggable = draggable;\n this.element.classList.toggle('isard-marker-draggable', draggable);\n return this;\n }\n\n isDraggable(): boolean {\n return this.draggable;\n }\n\n /** A popup that a click on the marker opens and closes, at the marker's position; give it an offset clearing the\n * marker (with the default pin, [0, -34]) */\n setPopup(popup: Popup | undefined): this {\n this.popup?.remove();\n this.popup = popup;\n popup?.setHeight(this.height);\n return this;\n }\n\n getPopup(): Popup | undefined {\n return this.popup;\n }\n\n /** Opens the marker's popup, or closes it if open */\n togglePopup(): this {\n if (!this.popup || !this.map) return this;\n if (this.popup.isOpen()) this.popup.remove();\n else this.popup.setLonLat(this.lonLat).addTo(this.map);\n return this;\n }\n\n /** Listens to the drag of the marker; returns the function that stops listening */\n on<K extends keyof MarkerEvents>(type: K, listener: (event: MarkerEvents[K]) => void): () => void {\n return this.events.on(type, listener);\n }\n\n addTo(map: GeoMap): this {\n if (this.map === map) return this;\n this.remove();\n this.map = map;\n map.attachOverlay(this, this.element);\n return this;\n }\n\n remove(): this {\n this.popup?.remove();\n this.map?.detachOverlay(this, this.element);\n this.map = undefined;\n this.grab = undefined;\n this.dragging = false;\n this.element.classList.remove('isard-marker-dragging');\n return this;\n }\n\n /** @internal */\n position(size: Point): void {\n if (!this.map) return;\n const top = place(this.map, this.element, this.lonLat, this.height, this.anchor, this.offset, size);\n const ground = top && this.height !== this.base ? this.map.project(this.lonLat, this.base) : undefined;\n if (!top || !ground) {\n this.stem.style.display = 'none';\n return;\n }\n // From the anchor down to what it stands on, a line turned toward it\n const [dx, dy] = [ground[0] - top[0], ground[1] - top[1]];\n this.stem.style.display = '';\n this.stem.style.height = `${Math.hypot(dx, dy)}px`;\n this.stem.style.transform = `rotate(${Math.atan2(dy, dx) - Math.PI / 2}rad)`;\n }\n\n private local(e: PointerEvent): Point | undefined {\n const rect = this.map?.getCanvas().getBoundingClientRect();\n return rect && [e.clientX - rect.left, e.clientY - rect.top];\n }\n\n private down(e: PointerEvent): void {\n this.swallowClick = false;\n if (!this.draggable || !this.map || e.button !== 0) return;\n // The gap to the position on the ground, below a raised marker\n const point = this.map.project(this.lonLat);\n const at = this.local(e);\n if (!point || !at) return;\n // The map must not start panning under the marker\n e.stopPropagation();\n e.preventDefault();\n this.element.setPointerCapture(e.pointerId);\n // The grabbed spot of the marker stays under the pointer, wherever the element was pressed\n this.grab = { start: at, gap: [at[0] - point[0], at[1] - point[1]] };\n this.dragging = false;\n }\n\n private move(e: PointerEvent): void {\n const at = this.local(e);\n if (!this.grab || !this.map || !at) return;\n e.stopPropagation();\n const { start, gap } = this.grab;\n if (!this.dragging && Math.hypot(at[0] - start[0], at[1] - start[1]) < DRAG_TOLERANCE) return;\n // On the relief: the ground under the point, read back from the picking pass\n const lonLat = this.map.unproject([at[0] - gap[0], at[1] - gap[1]]);\n if (!lonLat) return;\n if (!this.dragging) {\n this.dragging = true;\n this.element.classList.add('isard-marker-dragging');\n this.events.emit('dragstart', { target: this, lonLat: this.getLonLat() });\n }\n this.setLonLat(lonLat);\n this.events.emit('drag', { target: this, lonLat: this.getLonLat() });\n }\n\n private up(e: PointerEvent): void {\n if (!this.grab) return;\n e.stopPropagation();\n this.grab = undefined;\n if (this.element.hasPointerCapture(e.pointerId)) this.element.releasePointerCapture(e.pointerId);\n if (!this.dragging) return;\n this.dragging = false;\n this.swallowClick = true;\n this.element.classList.remove('isard-marker-dragging');\n this.events.emit('dragend', { target: this, lonLat: this.getLonLat() });\n }\n\n private click(e: MouseEvent): void {\n if (this.swallowClick) {\n this.swallowClick = false;\n e.stopImmediatePropagation();\n e.preventDefault();\n return;\n }\n if (this.popup) this.togglePopup();\n }\n}\n\nexport interface PopupOptions {\n /** A × button in the corner (default true) */\n closeButton?: boolean;\n /** A click on the map elsewhere closes the popup (default true) */\n closeOnClick?: boolean;\n /** CSS max-width of the popup (default '240px') */\n maxWidth?: string;\n /** Classes added to the popup, space separated */\n className?: string;\n /** Which part of the popup sits on the position, its tip there (default 'bottom': the popup is above the point) */\n anchor?: Anchor;\n /** Shift from the anchor, CSS pixels (default [0, 0]) */\n offset?: Point;\n}\n\nexport interface PopupEvents {\n open: { target: Popup };\n close: { target: Popup };\n}\n\n/** A box of content at a position, its tip pointing at it */\nexport class Popup {\n private readonly container: HTMLElement;\n private readonly content: HTMLElement;\n private readonly closeButton: HTMLButtonElement | undefined;\n private readonly anchor: Anchor;\n private readonly closeOnClick: boolean;\n private readonly events = new Emitter<PopupEvents>();\n private offset: Point;\n private lonLat: LonLat = [0, 0];\n private height = 0;\n private map: GeoMap | undefined;\n private stopListening: (() => void) | undefined;\n\n constructor(options: PopupOptions = {}) {\n this.anchor = options.anchor ?? 'bottom';\n this.offset = options.offset ?? [0, 0];\n this.closeOnClick = options.closeOnClick ?? true;\n this.container = document.createElement('div');\n this.container.className = `isard-popup isard-popup-anchor-${this.anchor}`;\n if (options.className) this.container.classList.add(...options.className.split(/\\s+/).filter(Boolean));\n this.container.style.maxWidth = options.maxWidth ?? '240px';\n const tip = document.createElement('div');\n tip.className = 'isard-popup-tip';\n this.content = document.createElement('div');\n this.content.className = 'isard-popup-content';\n if (options.closeButton ?? true) {\n this.container.classList.add('isard-popup-has-close');\n this.closeButton = document.createElement('button');\n this.closeButton.type = 'button';\n this.closeButton.className = 'isard-popup-close';\n this.closeButton.setAttribute('aria-label', 'Close popup');\n this.closeButton.textContent = '×';\n this.closeButton.addEventListener('click', () => this.remove());\n this.content.append(this.closeButton);\n }\n this.container.append(tip, this.content);\n }\n\n getElement(): HTMLElement {\n return this.container;\n }\n\n getLonLat(): LonLat {\n return [...this.lonLat];\n }\n\n setLonLat(lonLat: LonLat): this {\n this.lonLat = [lonLat[0], lonLat[1]];\n this.map?.positionOverlay(this);\n return this;\n }\n\n setOffset(offset: Point): this {\n this.offset = [offset[0], offset[1]];\n this.map?.positionOverlay(this);\n return this;\n }\n\n getHeight(): number {\n return this.height;\n }\n\n /** Metres above the ground (default 0); a marker's popup follows the marker's height */\n setHeight(height: number): this {\n this.height = Number.isFinite(height) ? height : 0;\n this.map?.positionOverlay(this);\n return this;\n }\n\n /** Content from an HTML string: only for trusted HTML (use `setText` for user or remote data) */\n setHTML(html: string): this {\n const template = document.createElement('template');\n template.innerHTML = html;\n return this.setDOMContent(template.content);\n }\n\n setText(text: string): this {\n return this.setDOMContent(document.createTextNode(text));\n }\n\n setDOMContent(node: Node): this {\n this.content.replaceChildren(node);\n if (this.closeButton) this.content.append(this.closeButton);\n this.map?.positionOverlay(this);\n return this;\n }\n\n isOpen(): boolean {\n return this.map !== undefined;\n }\n\n /** Listens to the popup opening or closing; returns the function that stops listening */\n on<K extends keyof PopupEvents>(type: K, listener: (event: PopupEvents[K]) => void): () => void {\n return this.events.on(type, listener);\n }\n\n addTo(map: GeoMap): this {\n if (this.map === map) return this;\n this.remove();\n this.map = map;\n map.attachOverlay(this, this.container);\n if (this.closeOnClick) {\n // From the next task on: a popup opened by a map click must not be closed by that same click\n queueMicrotask(() => {\n if (this.map === map && !this.stopListening) this.stopListening = map.on('click', () => this.remove());\n });\n }\n this.events.emit('open', { target: this });\n return this;\n }\n\n remove(): this {\n if (!this.map) return this;\n this.stopListening?.();\n this.stopListening = undefined;\n this.map.detachOverlay(this, this.container);\n this.map = undefined;\n this.events.emit('close', { target: this });\n return this;\n }\n\n /** @internal */\n position(size: Point): void {\n if (this.map) place(this.map, this.container, this.lonLat, this.height, this.anchor, this.offset, size);\n }\n}\n\nexport interface PanelOptions {\n /** The element shown in 3D (a video, an iframe, an image…), laid out at its CSS size */\n element: HTMLElement;\n /** Its width on the ground, metres; its height follows its CSS aspect */\n width: number;\n /** Degrees clockwise from north the side it faces (default 0: it faces north, read from the north) */\n heading?: number;\n /** Degrees it leans back from upright (default 0: standing; 90: lying flat) */\n pitch?: number;\n /** Metres of its bottom edge above the ground (the relief; default 0) */\n height?: number;\n /** Classes added to the element, space separated */\n className?: string;\n}\n\n/** `a × b`, 4 × 4 column-major */\nfunction multiply(a: ArrayLike<number>, b: ArrayLike<number>): number[] {\n const out = new Array<number>(16).fill(0);\n for (let c = 0; c < 4; c++) {\n for (let r = 0; r < 4; r++) {\n let sum = 0;\n for (let k = 0; k < 4; k++) sum += (a[k * 4 + r] ?? 0) * (b[c * 4 + k] ?? 0);\n out[c * 4 + r] = sum;\n }\n }\n return out;\n}\n\n/**\n * An element standing in 3D at a position: a video, a web page, a sign, `width` metres wide on the ground, facing\n * `heading`. Placed after each frame by a CSS 3D transform (the element is not drawn by WebGL: the scene does not\n * hide it); hidden when its position is behind the camera\n */\nexport class Panel {\n private readonly element: HTMLElement;\n private lonLat: LonLat = [0, 0];\n private width: number;\n private heading: number;\n private pitch: number;\n private height: number;\n private map: GeoMap | undefined;\n /** Its CSS size, read once it is on the page (`resize` reads it again) */\n private size: Point | undefined;\n\n constructor(options: PanelOptions) {\n this.element = options.element;\n this.width = options.width;\n this.heading = options.heading ?? 0;\n this.pitch = options.pitch ?? 0;\n this.height = options.height ?? 0;\n this.element.classList.add('isard-panel');\n if (options.className) this.element.classList.add(...options.className.split(/\\s+/).filter(Boolean));\n }\n\n getElement(): HTMLElement {\n return this.element;\n }\n\n getLonLat(): LonLat {\n return [...this.lonLat];\n }\n\n setLonLat(lonLat: LonLat): this {\n this.lonLat = [lonLat[0], lonLat[1]];\n this.map?.positionOverlay(this);\n return this;\n }\n\n /** Width (metres), heading and pitch (degrees), height of its bottom edge (metres), as in `PanelOptions` */\n setPlacement(placement: Partial<Pick<PanelOptions, 'width' | 'heading' | 'pitch' | 'height'>>): this {\n this.width = placement.width ?? this.width;\n this.heading = placement.heading ?? this.heading;\n this.pitch = placement.pitch ?? this.pitch;\n this.height = placement.height ?? this.height;\n this.map?.positionOverlay(this);\n return this;\n }\n\n /** Reads the element's CSS size again (after it changed) */\n resize(): this {\n this.size = undefined;\n this.map?.positionOverlay(this);\n return this;\n }\n\n addTo(map: GeoMap): this {\n if (this.map === map) return this;\n this.remove();\n this.map = map;\n map.attachOverlay(this, this.element);\n return this;\n }\n\n remove(): this {\n this.map?.detachOverlay(this, this.element);\n this.map = undefined;\n this.size = undefined;\n return this;\n }\n\n /** @internal */\n position(viewport: Point): void {\n const map = this.map;\n if (!map) return;\n this.size ??= [this.element.offsetWidth || 300, this.element.offsetHeight || 150];\n const [w, h] = this.size;\n const ground = map.elevationAt(this.lonLat) ?? 0;\n const local = map.engine.localMatrix(this.lonLat[0], this.lonLat[1], ground);\n // The element's pixels to the local frame (metres, x east, y north, z up): its bottom edge centered on the\n // position, `height` up, facing `heading`, leant back by `pitch`\n const rad = Math.PI / 180;\n const [hd, pt] = [this.heading * rad, this.pitch * rad];\n const s = this.width / w;\n // Across it (left to right as read from the side it faces), and up it\n const [ax, ay] = [-Math.cos(hd), Math.sin(hd)];\n const [ux, uy, uz] = [-Math.sin(hd) * Math.sin(pt), -Math.cos(hd) * Math.sin(pt), Math.cos(pt)];\n const top = h * s;\n const origin = [-ax * (this.width / 2) + ux * top, -ay * (this.width / 2) + uy * top, this.height + uz * top];\n const toLocal = [ax * s, ay * s, 0, 0, -ux * s, -uy * s, -uz * s, 0, 0, 0, 0, 0, ...origin, 1];\n // Clip space to the map's CSS pixels; the depth flattened\n const [vw, vh] = viewport;\n const toScreen = [vw / 2, 0, 0, 0, 0, -vh / 2, 0, 0, 0, 0, 0, 0, vw / 2, vh / 2, 0, 1];\n const clip = multiply(local, toLocal);\n // Behind the camera (its center): hidden\n const centerW = (clip[3] ?? 0) * (w / 2) + (clip[7] ?? 0) * (h / 2) + (clip[15] ?? 0);\n // Hidden without touching its display (the page's layout of its content)\n if (!(centerW > 0)) {\n this.element.style.visibility = 'hidden';\n return;\n }\n this.element.style.visibility = '';\n // Its depth axis the identity, out of the rest: its points have no depth, and a transform that cannot be\n // inverted is not drawn\n const m = multiply(toScreen, clip);\n m.splice(8, 4, 0, 0, 1, 0);\n for (const k of [2, 6, 14]) m[k] = 0;\n this.element.style.transform = `matrix3d(${m.join(',')})`;\n }\n}\n"]}
1
+ {"version":3,"file":"overlay.js","sourceRoot":"","sources":["../../src/ui/overlay.ts"],"names":[],"mappings":"AAoBA,MAAM,gBAAgB,GAA2B;IAC/C,MAAM,EAAE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EAAyE;QACzE,IAAI,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,EAAE,CAAC;YACnB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC;YAEzC,OAAO;QACT,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,EAAE,CAAC;QAEnC,yGAAyG;QACzG,wBAAwB;QACxB,MAAM,CAAC,GAAG,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAEnC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3B,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACvB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAC5D,CAAC;CACF","sourcesContent":["/**\n * DOM overlays tied to a position: markers and popups. The map places them all in one pass after each frame it draws\n * (camera moves, finer relief arriving), with a CSS transform from `map.project`: the browser only composites them,\n * nothing is laid out again.\n */\nimport type { GeoMap } from '../map.ts';\nimport type { LonLat, Point } from '../types.ts';\n\n/** Which part of the element sits on the position */\nexport type Anchor =\n | 'center'\n | 'top'\n | 'bottom'\n | 'left'\n | 'right'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right';\n\nconst ANCHOR_TRANSLATE: Record<Anchor, string> = {\n center: 'translate(-50%, -50%)',\n top: 'translate(-50%, 0)',\n bottom: 'translate(-50%, -100%)',\n left: 'translate(0, -50%)',\n right: 'translate(-100%, -50%)',\n 'top-left': 'translate(0, 0)',\n 'top-right': 'translate(-100%, 0)',\n 'bottom-left': 'translate(0, -100%)',\n 'bottom-right': 'translate(-100%, -100%)',\n};\n\n/** Where the anchor lies within the element, CSS percentages: the stem of a raised marker starts there */\nconst ANCHOR_POINT: Record<Anchor, [string, string]> = {\n center: ['50%', '50%'],\n top: ['50%', '0'],\n bottom: ['50%', '100%'],\n left: ['0', '50%'],\n right: ['100%', '50%'],\n 'top-left': ['0', '0'],\n 'top-right': ['100%', '0'],\n 'bottom-left': ['0', '100%'],\n 'bottom-right': ['100%', '100%'],\n};\n\n/** Overlays further than this out of the canvas (CSS pixels) are hidden: no part of them can show, and huge\n * transforms near the horizon would only cost the compositor */\nconst MARGIN = 500;\n/** A press on a draggable marker that moves less than this (CSS pixels) is a click */\nconst DRAG_TOLERANCE = 3;\n\n/** @internal What the map places after each frame */\nexport interface Positioned {\n /** Places the overlay for the current camera; `size` is the canvas size in CSS pixels */\n position(size: Point): void;\n}\n\n/** Typed listeners of an overlay */\nclass Emitter<E> {\n private readonly listeners: { [K in keyof E]?: Set<(event: E[K]) => void> } = {};\n\n on<K extends keyof E>(type: K, listener: (event: E[K]) => void): () => void {\n const set = this.listeners[type] ?? new Set();\n\n this.listeners[type] = set;\n set.add(listener);\n\n return () => set.delete(listener);\n }\n\n emit<K extends keyof E>(type: K, event: E[K]): void {\n this.listeners[type]?.forEach((listener) => {\n listener(event);\n });\n }\n}\n\n/** Moves `element` so that its anchor sits on `lonLat`, `height` metres above the ground, or hides it when the\n * position is out of sight; returns the screen point */\nconst place = (\n map: GeoMap,\n element: HTMLElement,\n lonLat: LonLat,\n height: number,\n anchor: Anchor,\n offset: Point,\n size: Point,\n): Point | undefined => {\n const point = map.project(lonLat, height);\n const visible =\n point !== undefined &&\n point[0] > -MARGIN &&\n point[0] < size[0] + MARGIN &&\n point[1] > -MARGIN &&\n point[1] < size[1] + MARGIN;\n\n if (!visible) {\n element.style.display = 'none';\n\n return undefined;\n }\n element.style.display = '';\n\n // Whole pixels: a fractional translation blurs text and icons\n const x = Math.round(point[0] + offset[0]);\n const y = Math.round(point[1] + offset[1]);\n\n element.style.transform = `translate(${x}px, ${y}px) ${ANCHOR_TRANSLATE[anchor]}`;\n\n return point;\n};\n\n/** Round pin, its tip at the bottom: the default marker */\nconst pin = (): HTMLElement => {\n const element = document.createElement('div');\n\n element.innerHTML =\n '<svg class=\"isard-marker-pin\" width=\"25\" height=\"34\" viewBox=\"0 0 25 34\" aria-hidden=\"true\">' +\n '<path fill=\"currentColor\" stroke=\"rgb(0 0 0 / 0.25)\" d=\"M12.5 33.5C12.5 33.5 .5 20.6 .5 12.5a12 12 0 0 1 24 0' +\n 'c0 8.1-12 21-12 21z\"/><circle cx=\"12.5\" cy=\"12.5\" r=\"4.5\" fill=\"#fff\"/></svg>';\n\n return element;\n};\n\nexport interface MarkerOptions {\n /** The element to show (default: a round pin) */\n element?: HTMLElement;\n /** Which part of the element sits on the position (default 'center' with an element of your own, 'bottom' for the\n * default pin) */\n anchor?: Anchor;\n /** Shift from the anchor, CSS pixels (default [0, 0]) */\n offset?: Point;\n /** The marker can be dragged over the map, on the relief (default false) */\n draggable?: boolean;\n /** Metres above the ground (default 0): a raised marker has a stem down to its position on the ground */\n height?: number;\n /** Classes added to the element, space separated */\n className?: string;\n}\n\nexport interface MarkerEvent {\n target: Marker;\n lonLat: LonLat;\n}\n\nexport interface MarkerEvents {\n dragstart: MarkerEvent;\n drag: MarkerEvent;\n dragend: MarkerEvent;\n}\n\n/** An element at a position on the map, optionally draggable */\nexport class Marker {\n private readonly element: HTMLElement;\n private readonly anchor: Anchor;\n private readonly events = new Emitter<MarkerEvents>();\n private offset: Point;\n private draggable: boolean;\n private lonLat: LonLat = [0, 0];\n private height: number;\n /** Metres above the ground of what the marker stands on, where its stem ends */\n private base = 0;\n /** The line from a raised marker down to the ground */\n private readonly stem: HTMLElement;\n private map: GeoMap | undefined;\n private popup: Popup | undefined;\n /** While pressed: the press point and the gap between the pointer and the marker's position */\n private grab: { start: Point; gap: Point } | undefined;\n private dragging = false;\n /** The click that ends a drag is not a click on the marker */\n private swallowClick = false;\n\n constructor(options: MarkerOptions = {}) {\n this.element = options.element ?? pin();\n this.anchor = options.anchor ?? (options.element ? 'center' : 'bottom');\n this.offset = options.offset ?? [0, 0];\n this.draggable = options.draggable ?? false;\n this.height = options.height ?? 0;\n this.stem = document.createElement('div');\n this.stem.className = 'isard-marker-stem';\n [this.stem.style.left, this.stem.style.top] = ANCHOR_POINT[this.anchor];\n this.element.append(this.stem);\n this.element.classList.add('isard-marker');\n if (options.className) this.element.classList.add(...options.className.split(/\\s+/).filter(Boolean));\n this.element.classList.toggle('isard-marker-draggable', this.draggable);\n this.element.addEventListener('pointerdown', (e) => this.down(e));\n this.element.addEventListener('pointermove', (e) => this.move(e));\n this.element.addEventListener('pointerup', (e) => this.up(e));\n this.element.addEventListener('pointercancel', (e) => this.up(e));\n this.element.addEventListener('click', (e) => this.click(e), { capture: true });\n }\n\n getElement(): HTMLElement {\n return this.element;\n }\n\n getLonLat(): LonLat {\n return [...this.lonLat];\n }\n\n setLonLat(lonLat: LonLat): this {\n this.lonLat = [lonLat[0], lonLat[1]];\n this.map?.positionOverlay(this);\n // An open popup of the marker goes with it\n if (this.popup?.isOpen()) this.popup.setLonLat(this.lonLat);\n\n return this;\n }\n\n getHeight(): number {\n return this.height;\n }\n\n /** Metres above the ground: a raised marker has a stem down to `base` metres, what it stands on (a roof, a mesh;\n * the ground by default); its popup is raised too */\n setHeight(height: number, base = 0): this {\n this.height = Number.isFinite(height) ? height : 0;\n this.base = Number.isFinite(base) ? Math.min(base, this.height) : 0;\n this.popup?.setHeight(this.height);\n this.map?.positionOverlay(this);\n\n return this;\n }\n\n setOffset(offset: Point): this {\n this.offset = [offset[0], offset[1]];\n this.map?.positionOverlay(this);\n\n return this;\n }\n\n setDraggable(draggable: boolean): this {\n this.draggable = draggable;\n this.element.classList.toggle('isard-marker-draggable', draggable);\n\n return this;\n }\n\n isDraggable(): boolean {\n return this.draggable;\n }\n\n /** A popup that a click on the marker opens and closes, at the marker's position; give it an offset clearing the\n * marker (with the default pin, [0, -34]) */\n setPopup(popup: Popup | undefined): this {\n this.popup?.remove();\n this.popup = popup;\n popup?.setHeight(this.height);\n\n return this;\n }\n\n getPopup(): Popup | undefined {\n return this.popup;\n }\n\n /** Opens the marker's popup, or closes it if open */\n togglePopup(): this {\n if (!this.popup || !this.map) return this;\n if (this.popup.isOpen()) this.popup.remove();\n else this.popup.setLonLat(this.lonLat).addTo(this.map);\n\n return this;\n }\n\n /** Listens to the drag of the marker; returns the function that stops listening */\n on<K extends keyof MarkerEvents>(type: K, listener: (event: MarkerEvents[K]) => void): () => void {\n return this.events.on(type, listener);\n }\n\n addTo(map: GeoMap): this {\n if (this.map === map) return this;\n // From another map: off it first (its popup with it); a popup opened before the marker is added stays open\n if (this.map) this.remove();\n this.map = map;\n map.attachOverlay(this, this.element);\n\n return this;\n }\n\n remove(): this {\n this.popup?.remove();\n this.map?.detachOverlay(this, this.element);\n this.map = undefined;\n this.grab = undefined;\n this.dragging = false;\n this.element.classList.remove('isard-marker-dragging');\n\n return this;\n }\n\n /** @internal */\n position(size: Point): void {\n if (!this.map) return;\n\n const top = place(this.map, this.element, this.lonLat, this.height, this.anchor, this.offset, size);\n const ground = top && this.height !== this.base ? this.map.project(this.lonLat, this.base) : undefined;\n\n if (!top || !ground) {\n this.stem.style.display = 'none';\n\n return;\n }\n\n // From the anchor down to what it stands on, a line turned toward it\n const [dx, dy] = [ground[0] - top[0], ground[1] - top[1]];\n\n this.stem.style.display = '';\n this.stem.style.height = `${Math.hypot(dx, dy)}px`;\n this.stem.style.transform = `rotate(${Math.atan2(dy, dx) - Math.PI / 2}rad)`;\n }\n\n private local(e: PointerEvent): Point | undefined {\n const rect = this.map?.getCanvas().getBoundingClientRect();\n\n return rect && [e.clientX - rect.left, e.clientY - rect.top];\n }\n\n private down(e: PointerEvent): void {\n this.swallowClick = false;\n if (!this.draggable || !this.map || e.button !== 0) return;\n\n // The gap to the position on the ground, below a raised marker\n const point = this.map.project(this.lonLat);\n const at = this.local(e);\n\n if (!point || !at) return;\n // The map must not start panning under the marker\n e.stopPropagation();\n e.preventDefault();\n this.element.setPointerCapture(e.pointerId);\n // The grabbed spot of the marker stays under the pointer, wherever the element was pressed\n this.grab = { start: at, gap: [at[0] - point[0], at[1] - point[1]] };\n this.dragging = false;\n }\n\n private move(e: PointerEvent): void {\n const at = this.local(e);\n\n if (!this.grab || !this.map || !at) return;\n e.stopPropagation();\n\n const { start, gap } = this.grab;\n\n if (!this.dragging && Math.hypot(at[0] - start[0], at[1] - start[1]) < DRAG_TOLERANCE) return;\n\n // On the relief: the ground under the point, read back from the picking pass\n const lonLat = this.map.unproject([at[0] - gap[0], at[1] - gap[1]]);\n\n if (!lonLat) return;\n if (!this.dragging) {\n this.dragging = true;\n this.element.classList.add('isard-marker-dragging');\n this.events.emit('dragstart', { target: this, lonLat: this.getLonLat() });\n }\n this.setLonLat(lonLat);\n this.events.emit('drag', { target: this, lonLat: this.getLonLat() });\n }\n\n private up(e: PointerEvent): void {\n if (!this.grab) return;\n e.stopPropagation();\n this.grab = undefined;\n if (this.element.hasPointerCapture(e.pointerId)) this.element.releasePointerCapture(e.pointerId);\n if (!this.dragging) return;\n this.dragging = false;\n this.swallowClick = true;\n this.element.classList.remove('isard-marker-dragging');\n this.events.emit('dragend', { target: this, lonLat: this.getLonLat() });\n }\n\n private click(e: MouseEvent): void {\n if (this.swallowClick) {\n this.swallowClick = false;\n e.stopImmediatePropagation();\n e.preventDefault();\n\n return;\n }\n if (this.popup) this.togglePopup();\n }\n}\n\nexport interface PopupOptions {\n /** A × button in the corner (default true) */\n closeButton?: boolean;\n /** A click on the map elsewhere closes the popup (default true) */\n closeOnClick?: boolean;\n /** CSS max-width of the popup (default '240px') */\n maxWidth?: string;\n /** Classes added to the popup, space separated */\n className?: string;\n /** Which part of the popup sits on the position, its tip there (default 'bottom': the popup is above the point) */\n anchor?: Anchor;\n /** Shift from the anchor, CSS pixels (default [0, 0]) */\n offset?: Point;\n}\n\nexport interface PopupEvents {\n open: { target: Popup };\n close: { target: Popup };\n}\n\n/** A box of content at a position, its tip pointing at it */\nexport class Popup {\n private readonly container: HTMLElement;\n private readonly content: HTMLElement;\n private readonly closeButton: HTMLButtonElement | undefined;\n private readonly anchor: Anchor;\n private readonly closeOnClick: boolean;\n private readonly events = new Emitter<PopupEvents>();\n private offset: Point;\n private lonLat: LonLat = [0, 0];\n private height = 0;\n private map: GeoMap | undefined;\n private stopListening: (() => void) | undefined;\n\n constructor(options: PopupOptions = {}) {\n this.anchor = options.anchor ?? 'bottom';\n this.offset = options.offset ?? [0, 0];\n this.closeOnClick = options.closeOnClick ?? true;\n this.container = document.createElement('div');\n this.container.className = `isard-popup isard-popup-anchor-${this.anchor}`;\n if (options.className) this.container.classList.add(...options.className.split(/\\s+/).filter(Boolean));\n this.container.style.maxWidth = options.maxWidth ?? '240px';\n\n const tip = document.createElement('div');\n\n tip.className = 'isard-popup-tip';\n this.content = document.createElement('div');\n this.content.className = 'isard-popup-content';\n if (options.closeButton ?? true) {\n this.container.classList.add('isard-popup-has-close');\n this.closeButton = document.createElement('button');\n this.closeButton.type = 'button';\n this.closeButton.className = 'isard-popup-close';\n this.closeButton.setAttribute('aria-label', 'Close popup');\n this.closeButton.textContent = '×';\n this.closeButton.addEventListener('click', () => this.remove());\n this.content.append(this.closeButton);\n }\n this.container.append(tip, this.content);\n }\n\n getElement(): HTMLElement {\n return this.container;\n }\n\n getLonLat(): LonLat {\n return [...this.lonLat];\n }\n\n setLonLat(lonLat: LonLat): this {\n this.lonLat = [lonLat[0], lonLat[1]];\n this.map?.positionOverlay(this);\n\n return this;\n }\n\n setOffset(offset: Point): this {\n this.offset = [offset[0], offset[1]];\n this.map?.positionOverlay(this);\n\n return this;\n }\n\n getHeight(): number {\n return this.height;\n }\n\n /** Metres above the ground (default 0); a marker's popup follows the marker's height */\n setHeight(height: number): this {\n this.height = Number.isFinite(height) ? height : 0;\n this.map?.positionOverlay(this);\n\n return this;\n }\n\n /** Content from an HTML string: only for trusted HTML (use `setText` for user or remote data) */\n setHTML(html: string): this {\n const template = document.createElement('template');\n\n template.innerHTML = html;\n\n return this.setDOMContent(template.content);\n }\n\n setText(text: string): this {\n return this.setDOMContent(document.createTextNode(text));\n }\n\n setDOMContent(node: Node): this {\n this.content.replaceChildren(node);\n if (this.closeButton) this.content.append(this.closeButton);\n this.map?.positionOverlay(this);\n\n return this;\n }\n\n isOpen(): boolean {\n return this.map !== undefined;\n }\n\n /** Listens to the popup opening or closing; returns the function that stops listening */\n on<K extends keyof PopupEvents>(type: K, listener: (event: PopupEvents[K]) => void): () => void {\n return this.events.on(type, listener);\n }\n\n addTo(map: GeoMap): this {\n if (this.map === map) return this;\n this.remove();\n this.map = map;\n map.attachOverlay(this, this.container);\n if (this.closeOnClick) {\n // From the next task on: a popup opened by a map click must not be closed by that same click\n queueMicrotask(() => {\n if (this.map === map && !this.stopListening) this.stopListening = map.on('click', () => this.remove());\n });\n }\n this.events.emit('open', { target: this });\n\n return this;\n }\n\n remove(): this {\n if (!this.map) return this;\n this.stopListening?.();\n this.stopListening = undefined;\n this.map.detachOverlay(this, this.container);\n this.map = undefined;\n this.events.emit('close', { target: this });\n\n return this;\n }\n\n /** @internal */\n position(size: Point): void {\n if (this.map) place(this.map, this.container, this.lonLat, this.height, this.anchor, this.offset, size);\n }\n}\n\nexport interface PanelOptions {\n /** The element shown in 3D (a video, an iframe, an image…), laid out at its CSS size */\n element: HTMLElement;\n /** Its width on the ground, metres; its height follows its CSS aspect */\n width: number;\n /** Degrees clockwise from north the side it faces (default 0: it faces north, read from the north) */\n heading?: number;\n /** Degrees it leans back from upright (default 0: standing; 90: lying flat) */\n pitch?: number;\n /** Metres of its bottom edge above the ground (the relief; default 0) */\n height?: number;\n /** Classes added to the element, space separated */\n className?: string;\n}\n\n/** `a × b`, 4 × 4 column-major */\nconst multiply = (a: ArrayLike<number>, b: ArrayLike<number>): number[] =>\n Array.from({ length: 16 }, (_, i) => {\n const [c, r] = [Math.floor(i / 4), i % 4];\n\n return [0, 1, 2, 3].reduce((sum, k) => sum + (a[k * 4 + r] ?? 0) * (b[c * 4 + k] ?? 0), 0);\n });\n\n/**\n * An element standing in 3D at a position: a video, a web page, a sign, `width` metres wide on the ground, facing\n * `heading`. Placed after each frame by a CSS 3D transform (the element is not drawn by WebGL: the scene does not\n * hide it); hidden when its position is behind the camera\n */\nexport class Panel {\n private readonly element: HTMLElement;\n private lonLat: LonLat = [0, 0];\n private width: number;\n private heading: number;\n private pitch: number;\n private height: number;\n private map: GeoMap | undefined;\n /** Its CSS size, read once it is on the page (`resize` reads it again) */\n private size: Point | undefined;\n\n constructor(options: PanelOptions) {\n this.element = options.element;\n this.width = options.width;\n this.heading = options.heading ?? 0;\n this.pitch = options.pitch ?? 0;\n this.height = options.height ?? 0;\n this.element.classList.add('isard-panel');\n if (options.className) this.element.classList.add(...options.className.split(/\\s+/).filter(Boolean));\n }\n\n getElement(): HTMLElement {\n return this.element;\n }\n\n getLonLat(): LonLat {\n return [...this.lonLat];\n }\n\n setLonLat(lonLat: LonLat): this {\n this.lonLat = [lonLat[0], lonLat[1]];\n this.map?.positionOverlay(this);\n\n return this;\n }\n\n /** Width (metres), heading and pitch (degrees), height of its bottom edge (metres), as in `PanelOptions` */\n setPlacement(placement: Partial<Pick<PanelOptions, 'width' | 'heading' | 'pitch' | 'height'>>): this {\n this.width = placement.width ?? this.width;\n this.heading = placement.heading ?? this.heading;\n this.pitch = placement.pitch ?? this.pitch;\n this.height = placement.height ?? this.height;\n this.map?.positionOverlay(this);\n\n return this;\n }\n\n /** Reads the element's CSS size again (after it changed) */\n resize(): this {\n this.size = undefined;\n this.map?.positionOverlay(this);\n\n return this;\n }\n\n addTo(map: GeoMap): this {\n if (this.map === map) return this;\n // From another map: off it first (its popup with it); a popup opened before the marker is added stays open\n if (this.map) this.remove();\n this.map = map;\n map.attachOverlay(this, this.element);\n\n return this;\n }\n\n remove(): this {\n this.map?.detachOverlay(this, this.element);\n this.map = undefined;\n this.size = undefined;\n\n return this;\n }\n\n /** @internal */\n position(viewport: Point): void {\n const map = this.map;\n\n if (!map) return;\n this.size ??= [this.element.offsetWidth || 300, this.element.offsetHeight || 150];\n\n const [w, h] = this.size;\n const ground = map.elevationAt(this.lonLat) ?? 0;\n const local = map.engine.localMatrix(this.lonLat[0], this.lonLat[1], ground);\n // The element's pixels to the local frame (metres, x east, y north, z up): its bottom edge centered on the\n // position, `height` up, facing `heading`, leant back by `pitch`\n const rad = Math.PI / 180;\n const [hd, pt] = [this.heading * rad, this.pitch * rad];\n const s = this.width / w;\n // Across it (left to right as read from the side it faces), and up it\n const [ax, ay] = [-Math.cos(hd), Math.sin(hd)];\n const [ux, uy, uz] = [-Math.sin(hd) * Math.sin(pt), -Math.cos(hd) * Math.sin(pt), Math.cos(pt)];\n const top = h * s;\n const origin = [-ax * (this.width / 2) + ux * top, -ay * (this.width / 2) + uy * top, this.height + uz * top];\n const toLocal = [ax * s, ay * s, 0, 0, -ux * s, -uy * s, -uz * s, 0, 0, 0, 0, 0, ...origin, 1];\n // Clip space to the map's CSS pixels; the depth flattened\n const [vw, vh] = viewport;\n const toScreen = [vw / 2, 0, 0, 0, 0, -vh / 2, 0, 0, 0, 0, 0, 0, vw / 2, vh / 2, 0, 1];\n const clip = multiply(local, toLocal);\n // Behind the camera (its center): hidden\n const centerW = (clip[3] ?? 0) * (w / 2) + (clip[7] ?? 0) * (h / 2) + (clip[15] ?? 0);\n\n // Hidden without touching its display (the page's layout of its content)\n if (!(centerW > 0)) {\n this.element.style.visibility = 'hidden';\n\n return;\n }\n this.element.style.visibility = '';\n\n // Its depth axis the identity, out of the rest: its points have no depth, and a transform that cannot be\n // inverted is not drawn\n const m = multiply(toScreen, clip);\n\n m.splice(8, 4, 0, 0, 1, 0);\n [2, 6, 14].forEach((k) => {\n m[k] = 0;\n });\n this.element.style.transform = `matrix3d(${m.join(',')})`;\n }\n}\n"]}
@@ -4,4 +4,4 @@
4
4
  * element around the map (its container's class may be replaced by a framework: nothing depends on it).
5
5
  */
6
6
  /** Adds the overlay styles to a document, once; first in the head so application rules win at equal specificity */
7
- export declare function injectStyle(doc: Document): void;
7
+ export declare const injectStyle: (doc: Document) => void;
package/dist/ui/style.js CHANGED
@@ -121,7 +121,7 @@ const CSS = `
121
121
  `;
122
122
  const styled = new WeakSet();
123
123
  /** Adds the overlay styles to a document, once; first in the head so application rules win at equal specificity */
124
- export function injectStyle(doc) {
124
+ export const injectStyle = (doc) => {
125
125
  if (styled.has(doc))
126
126
  return;
127
127
  styled.add(doc);
@@ -129,5 +129,5 @@ export function injectStyle(doc) {
129
129
  style.dataset.isard = '';
130
130
  style.textContent = CSS;
131
131
  doc.head.prepend(style);
132
- }
132
+ };
133
133
  //# sourceMappingURL=style.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","sourceRoot":"","sources":["../../src/ui/style.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,GAAG,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmHX,CAAC;AAEF,MAAM,MAAM,GAAG,IAAI,OAAO,EAAY,CAAC;AAEvC,mHAAmH;AACnH,MAAM,UAAU,WAAW,CAAC,GAAa;IACvC,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO;IAC5B,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,MAAM,KAAK,GAAG,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACzC,KAAK,CAAC,OAAO,CAAC,KAAK,GAAG,EAAE,CAAC;IACzB,KAAK,CAAC,WAAW,GAAG,GAAG,CAAC;IACxB,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["/**\n * Styles of the DOM overlays (markers, popups, controls), injected once per document so the package needs no CSS\n * file. Colors are custom properties, defaults on the root with no specificity: an application restyles them on any\n * element around the map (its container's class may be replaced by a framework: nothing depends on it).\n */\n\nconst CSS = `\n:where(:root) {\n --isard-ctrl-bg: #fff;\n --isard-ctrl-fg: #333;\n --isard-ctrl-hover: rgb(0 0 0 / 0.05);\n --isard-ctrl-active: #1d2433;\n --isard-ctrl-active-fg: #fff;\n --isard-ctrl-border: #ddd;\n --isard-ctrl-shadow: 0 0 0 2px rgb(0 0 0 / 0.1);\n --isard-popup-bg: #fff;\n --isard-popup-fg: #1d2433;\n --isard-marker-color: #3a6fd8;\n --isard-attrib-bg: rgb(255 255 255 / 0.5);\n --isard-attrib-fg: rgb(0 0 0 / 0.75);\n --isard-focus: #3a6fd8;\n}\n.isard-canvas:focus { outline: none; }\n.isard-canvas:focus-visible { outline: 2px solid var(--isard-focus); outline-offset: -2px; }\n.isard-overlay { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }\n.isard-ctrl-top-left, .isard-ctrl-top-right, .isard-ctrl-bottom-left, .isard-ctrl-bottom-right {\n position: absolute; pointer-events: none; z-index: 2;\n}\n.isard-ctrl-top-left { top: 0; left: 0; }\n.isard-ctrl-top-right { top: 0; right: 0; }\n.isard-ctrl-bottom-left { bottom: 0; left: 0; }\n.isard-ctrl-bottom-right { bottom: 0; right: 0; }\n.isard-ctrl { clear: both; pointer-events: auto; transform: translate(0, 0); }\n.isard-ctrl-top-left .isard-ctrl { float: left; margin: 10px 0 0 10px; }\n.isard-ctrl-top-right .isard-ctrl { float: right; margin: 10px 10px 0 0; }\n.isard-ctrl-bottom-left .isard-ctrl { float: left; margin: 0 0 10px 10px; }\n.isard-ctrl-bottom-right .isard-ctrl { float: right; margin: 0 10px 10px 0; }\n.isard-ctrl-group { background: var(--isard-ctrl-bg); border-radius: 4px; box-shadow: var(--isard-ctrl-shadow); }\n.isard-ctrl-group button {\n display: block; width: 29px; height: 29px; padding: 0; margin: 0; border: 0; box-sizing: border-box;\n background: transparent; color: var(--isard-ctrl-fg); cursor: pointer; font: inherit;\n}\n.isard-ctrl-group button + button { border-top: 1px solid var(--isard-ctrl-border); }\n.isard-ctrl-group button:first-child { border-radius: 4px 4px 0 0; }\n.isard-ctrl-group button:last-child { border-radius: 0 0 4px 4px; }\n.isard-ctrl-group button:only-child { border-radius: inherit; }\n.isard-ctrl-group button:hover { background-color: var(--isard-ctrl-hover); }\n.isard-ctrl-group button:focus-visible { outline: 2px solid var(--isard-ctrl-active); outline-offset: -2px; }\n.isard-ctrl-group button.active { background: var(--isard-ctrl-active); color: var(--isard-ctrl-active-fg); }\n.isard-ctrl-group button svg { display: block; margin: auto; pointer-events: none; }\n.isard-ctrl-compass svg { transition: transform 0.05s; }\n.isard-marker { position: absolute; top: 0; left: 0; pointer-events: auto; will-change: transform; }\n.isard-marker-draggable { cursor: grab; touch-action: none; }\n.isard-marker-dragging { cursor: grabbing; }\n.isard-marker-stem { position: absolute; z-index: -1; width: 2px; margin-left: -1px; transform-origin: top center; background: var(--isard-marker-color); opacity: 0.8; pointer-events: none; }\n.isard-marker-stem::after { content: \"\"; position: absolute; bottom: -3px; left: -2px; width: 6px; height: 6px; border-radius: 50%; background: inherit; }\n.isard-marker-pin { display: block; color: var(--isard-marker-color); filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.35)); }\n.isard-panel { position: absolute; top: 0; left: 0; transform-origin: 0 0; pointer-events: auto; will-change: transform; }\n.isard-popup {\n position: absolute; top: 0; left: 0; display: flex; pointer-events: none; will-change: transform; z-index: 1;\n color: var(--isard-popup-fg);\n}\n.isard-popup-anchor-top, .isard-popup-anchor-top-left, .isard-popup-anchor-top-right { flex-direction: column; }\n.isard-popup-anchor-bottom, .isard-popup-anchor-bottom-left, .isard-popup-anchor-bottom-right {\n flex-direction: column-reverse;\n}\n.isard-popup-anchor-left { flex-direction: row; }\n.isard-popup-anchor-right { flex-direction: row-reverse; }\n.isard-popup-tip { width: 0; height: 0; border: 10px solid transparent; z-index: 1; }\n.isard-popup-anchor-top .isard-popup-tip { align-self: center; border-top: none; border-bottom-color: var(--isard-popup-bg); }\n.isard-popup-anchor-top-left .isard-popup-tip {\n align-self: flex-start; border-top: none; border-left: none; border-bottom-color: var(--isard-popup-bg);\n}\n.isard-popup-anchor-top-right .isard-popup-tip {\n align-self: flex-end; border-top: none; border-right: none; border-bottom-color: var(--isard-popup-bg);\n}\n.isard-popup-anchor-bottom .isard-popup-tip { align-self: center; border-bottom: none; border-top-color: var(--isard-popup-bg); }\n.isard-popup-anchor-bottom-left .isard-popup-tip {\n align-self: flex-start; border-bottom: none; border-left: none; border-top-color: var(--isard-popup-bg);\n}\n.isard-popup-anchor-bottom-right .isard-popup-tip {\n align-self: flex-end; border-bottom: none; border-right: none; border-top-color: var(--isard-popup-bg);\n}\n.isard-popup-anchor-left .isard-popup-tip { align-self: center; border-left: none; border-right-color: var(--isard-popup-bg); }\n.isard-popup-anchor-right .isard-popup-tip { align-self: center; border-right: none; border-left-color: var(--isard-popup-bg); }\n.isard-popup-content {\n position: relative; padding: 12px 14px; border-radius: 4px; background: var(--isard-popup-bg);\n box-shadow: 0 1px 4px rgb(0 0 0 / 0.2); pointer-events: auto; overflow-wrap: break-word;\n}\n.isard-popup-has-close .isard-popup-content { padding-right: 26px; }\n.isard-popup-anchor-top-left .isard-popup-content { border-top-left-radius: 0; }\n.isard-popup-anchor-top-right .isard-popup-content { border-top-right-radius: 0; }\n.isard-popup-anchor-bottom-left .isard-popup-content { border-bottom-left-radius: 0; }\n.isard-popup-anchor-bottom-right .isard-popup-content { border-bottom-right-radius: 0; }\n.isard-popup-close {\n position: absolute; top: 0; right: 0; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 0 4px 0 4px;\n background: transparent; color: inherit; font: 18px/22px system-ui, sans-serif; cursor: pointer;\n}\n.isard-popup-close:hover { background: rgb(0 0 0 / 0.05); }\n.isard-popup-close:focus-visible, .isard-attrib-button:focus-visible, .isard-attrib a:focus-visible {\n outline: 2px solid var(--isard-focus); outline-offset: -2px;\n}\n.isard-attrib {\n display: flex; align-items: center; gap: 4px; padding: 0 5px; border-radius: 4px; background: var(--isard-attrib-bg);\n color: var(--isard-attrib-fg); font: 12px/20px system-ui, sans-serif;\n}\n.isard-ctrl-bottom-right .isard-ctrl.isard-attrib, .isard-ctrl-bottom-left .isard-ctrl.isard-attrib { margin-bottom: 0; }\n.isard-ctrl-bottom-right .isard-ctrl.isard-attrib { margin-right: 0; border-radius: 4px 0 0 0; }\n.isard-ctrl-bottom-left .isard-ctrl.isard-attrib { margin-left: 0; border-radius: 0 4px 0 0; }\n.isard-attrib a { color: inherit; text-decoration: none; }\n.isard-attrib a:hover { text-decoration: underline; }\n.isard-attrib-button {\n display: none; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 12px; flex: none;\n background: var(--isard-ctrl-bg); color: var(--isard-ctrl-fg); cursor: pointer;\n}\n.isard-attrib-button svg { display: block; margin: auto; }\n.isard-ctrl.isard-attrib.isard-attrib-compact { min-height: 24px; padding: 2px; border-radius: 12px; margin: 0 10px 10px; }\n.isard-attrib-compact .isard-attrib-button { display: block; }\n.isard-attrib-compact .isard-attrib-inner { display: none; padding: 0 6px 0 2px; }\n.isard-attrib-compact.isard-attrib-open { background: var(--isard-ctrl-bg); }\n.isard-attrib-compact.isard-attrib-open .isard-attrib-inner { display: block; }\n`;\n\nconst styled = new WeakSet<Document>();\n\n/** Adds the overlay styles to a document, once; first in the head so application rules win at equal specificity */\nexport function injectStyle(doc: Document): void {\n if (styled.has(doc)) return;\n styled.add(doc);\n const style = doc.createElement('style');\n style.dataset.isard = '';\n style.textContent = CSS;\n doc.head.prepend(style);\n}\n"]}
1
+ {"version":3,"file":"style.js","sourceRoot":"","sources":["../../src/ui/style.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,GAAG,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmHX,CAAC;AAEF,MAAM,MAAM,GAAG,IAAI,OAAO,EAAY,CAAC;AAEvC,mHAAmH;AACnH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAa,EAAQ,EAAE;IACjD,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO;IAC5B,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAEhB,MAAM,KAAK,GAAG,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAEzC,KAAK,CAAC,OAAO,CAAC,KAAK,GAAG,EAAE,CAAC;IACzB,KAAK,CAAC,WAAW,GAAG,GAAG,CAAC;IACxB,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC,CAAC","sourcesContent":["/**\n * Styles of the DOM overlays (markers, popups, controls), injected once per document so the package needs no CSS\n * file. Colors are custom properties, defaults on the root with no specificity: an application restyles them on any\n * element around the map (its container's class may be replaced by a framework: nothing depends on it).\n */\n\nconst CSS = `\n:where(:root) {\n --isard-ctrl-bg: #fff;\n --isard-ctrl-fg: #333;\n --isard-ctrl-hover: rgb(0 0 0 / 0.05);\n --isard-ctrl-active: #1d2433;\n --isard-ctrl-active-fg: #fff;\n --isard-ctrl-border: #ddd;\n --isard-ctrl-shadow: 0 0 0 2px rgb(0 0 0 / 0.1);\n --isard-popup-bg: #fff;\n --isard-popup-fg: #1d2433;\n --isard-marker-color: #3a6fd8;\n --isard-attrib-bg: rgb(255 255 255 / 0.5);\n --isard-attrib-fg: rgb(0 0 0 / 0.75);\n --isard-focus: #3a6fd8;\n}\n.isard-canvas:focus { outline: none; }\n.isard-canvas:focus-visible { outline: 2px solid var(--isard-focus); outline-offset: -2px; }\n.isard-overlay { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }\n.isard-ctrl-top-left, .isard-ctrl-top-right, .isard-ctrl-bottom-left, .isard-ctrl-bottom-right {\n position: absolute; pointer-events: none; z-index: 2;\n}\n.isard-ctrl-top-left { top: 0; left: 0; }\n.isard-ctrl-top-right { top: 0; right: 0; }\n.isard-ctrl-bottom-left { bottom: 0; left: 0; }\n.isard-ctrl-bottom-right { bottom: 0; right: 0; }\n.isard-ctrl { clear: both; pointer-events: auto; transform: translate(0, 0); }\n.isard-ctrl-top-left .isard-ctrl { float: left; margin: 10px 0 0 10px; }\n.isard-ctrl-top-right .isard-ctrl { float: right; margin: 10px 10px 0 0; }\n.isard-ctrl-bottom-left .isard-ctrl { float: left; margin: 0 0 10px 10px; }\n.isard-ctrl-bottom-right .isard-ctrl { float: right; margin: 0 10px 10px 0; }\n.isard-ctrl-group { background: var(--isard-ctrl-bg); border-radius: 4px; box-shadow: var(--isard-ctrl-shadow); }\n.isard-ctrl-group button {\n display: block; width: 29px; height: 29px; padding: 0; margin: 0; border: 0; box-sizing: border-box;\n background: transparent; color: var(--isard-ctrl-fg); cursor: pointer; font: inherit;\n}\n.isard-ctrl-group button + button { border-top: 1px solid var(--isard-ctrl-border); }\n.isard-ctrl-group button:first-child { border-radius: 4px 4px 0 0; }\n.isard-ctrl-group button:last-child { border-radius: 0 0 4px 4px; }\n.isard-ctrl-group button:only-child { border-radius: inherit; }\n.isard-ctrl-group button:hover { background-color: var(--isard-ctrl-hover); }\n.isard-ctrl-group button:focus-visible { outline: 2px solid var(--isard-ctrl-active); outline-offset: -2px; }\n.isard-ctrl-group button.active { background: var(--isard-ctrl-active); color: var(--isard-ctrl-active-fg); }\n.isard-ctrl-group button svg { display: block; margin: auto; pointer-events: none; }\n.isard-ctrl-compass svg { transition: transform 0.05s; }\n.isard-marker { position: absolute; top: 0; left: 0; pointer-events: auto; will-change: transform; }\n.isard-marker-draggable { cursor: grab; touch-action: none; }\n.isard-marker-dragging { cursor: grabbing; }\n.isard-marker-stem { position: absolute; z-index: -1; width: 2px; margin-left: -1px; transform-origin: top center; background: var(--isard-marker-color); opacity: 0.8; pointer-events: none; }\n.isard-marker-stem::after { content: \"\"; position: absolute; bottom: -3px; left: -2px; width: 6px; height: 6px; border-radius: 50%; background: inherit; }\n.isard-marker-pin { display: block; color: var(--isard-marker-color); filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.35)); }\n.isard-panel { position: absolute; top: 0; left: 0; transform-origin: 0 0; pointer-events: auto; will-change: transform; }\n.isard-popup {\n position: absolute; top: 0; left: 0; display: flex; pointer-events: none; will-change: transform; z-index: 1;\n color: var(--isard-popup-fg);\n}\n.isard-popup-anchor-top, .isard-popup-anchor-top-left, .isard-popup-anchor-top-right { flex-direction: column; }\n.isard-popup-anchor-bottom, .isard-popup-anchor-bottom-left, .isard-popup-anchor-bottom-right {\n flex-direction: column-reverse;\n}\n.isard-popup-anchor-left { flex-direction: row; }\n.isard-popup-anchor-right { flex-direction: row-reverse; }\n.isard-popup-tip { width: 0; height: 0; border: 10px solid transparent; z-index: 1; }\n.isard-popup-anchor-top .isard-popup-tip { align-self: center; border-top: none; border-bottom-color: var(--isard-popup-bg); }\n.isard-popup-anchor-top-left .isard-popup-tip {\n align-self: flex-start; border-top: none; border-left: none; border-bottom-color: var(--isard-popup-bg);\n}\n.isard-popup-anchor-top-right .isard-popup-tip {\n align-self: flex-end; border-top: none; border-right: none; border-bottom-color: var(--isard-popup-bg);\n}\n.isard-popup-anchor-bottom .isard-popup-tip { align-self: center; border-bottom: none; border-top-color: var(--isard-popup-bg); }\n.isard-popup-anchor-bottom-left .isard-popup-tip {\n align-self: flex-start; border-bottom: none; border-left: none; border-top-color: var(--isard-popup-bg);\n}\n.isard-popup-anchor-bottom-right .isard-popup-tip {\n align-self: flex-end; border-bottom: none; border-right: none; border-top-color: var(--isard-popup-bg);\n}\n.isard-popup-anchor-left .isard-popup-tip { align-self: center; border-left: none; border-right-color: var(--isard-popup-bg); }\n.isard-popup-anchor-right .isard-popup-tip { align-self: center; border-right: none; border-left-color: var(--isard-popup-bg); }\n.isard-popup-content {\n position: relative; padding: 12px 14px; border-radius: 4px; background: var(--isard-popup-bg);\n box-shadow: 0 1px 4px rgb(0 0 0 / 0.2); pointer-events: auto; overflow-wrap: break-word;\n}\n.isard-popup-has-close .isard-popup-content { padding-right: 26px; }\n.isard-popup-anchor-top-left .isard-popup-content { border-top-left-radius: 0; }\n.isard-popup-anchor-top-right .isard-popup-content { border-top-right-radius: 0; }\n.isard-popup-anchor-bottom-left .isard-popup-content { border-bottom-left-radius: 0; }\n.isard-popup-anchor-bottom-right .isard-popup-content { border-bottom-right-radius: 0; }\n.isard-popup-close {\n position: absolute; top: 0; right: 0; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 0 4px 0 4px;\n background: transparent; color: inherit; font: 18px/22px system-ui, sans-serif; cursor: pointer;\n}\n.isard-popup-close:hover { background: rgb(0 0 0 / 0.05); }\n.isard-popup-close:focus-visible, .isard-attrib-button:focus-visible, .isard-attrib a:focus-visible {\n outline: 2px solid var(--isard-focus); outline-offset: -2px;\n}\n.isard-attrib {\n display: flex; align-items: center; gap: 4px; padding: 0 5px; border-radius: 4px; background: var(--isard-attrib-bg);\n color: var(--isard-attrib-fg); font: 12px/20px system-ui, sans-serif;\n}\n.isard-ctrl-bottom-right .isard-ctrl.isard-attrib, .isard-ctrl-bottom-left .isard-ctrl.isard-attrib { margin-bottom: 0; }\n.isard-ctrl-bottom-right .isard-ctrl.isard-attrib { margin-right: 0; border-radius: 4px 0 0 0; }\n.isard-ctrl-bottom-left .isard-ctrl.isard-attrib { margin-left: 0; border-radius: 0 4px 0 0; }\n.isard-attrib a { color: inherit; text-decoration: none; }\n.isard-attrib a:hover { text-decoration: underline; }\n.isard-attrib-button {\n display: none; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 12px; flex: none;\n background: var(--isard-ctrl-bg); color: var(--isard-ctrl-fg); cursor: pointer;\n}\n.isard-attrib-button svg { display: block; margin: auto; }\n.isard-ctrl.isard-attrib.isard-attrib-compact { min-height: 24px; padding: 2px; border-radius: 12px; margin: 0 10px 10px; }\n.isard-attrib-compact .isard-attrib-button { display: block; }\n.isard-attrib-compact .isard-attrib-inner { display: none; padding: 0 6px 0 2px; }\n.isard-attrib-compact.isard-attrib-open { background: var(--isard-ctrl-bg); }\n.isard-attrib-compact.isard-attrib-open .isard-attrib-inner { display: block; }\n`;\n\nconst styled = new WeakSet<Document>();\n\n/** Adds the overlay styles to a document, once; first in the head so application rules win at equal specificity */\nexport const injectStyle = (doc: Document): void => {\n if (styled.has(doc)) return;\n styled.add(doc);\n\n const style = doc.createElement('style');\n\n style.dataset.isard = '';\n style.textContent = CSS;\n doc.head.prepend(style);\n};\n"]}
@@ -9,14 +9,14 @@ export type Step = (now: number) => boolean;
9
9
  /** What a step needs of the engine, read at each frame */
10
10
  type Target = () => Pick<Engine, 'setCamera' | 'clearPreload'>;
11
11
  /** MapLibre's default easing: cubic Bézier (0.25, 0.1, 0.25, 1) */
12
- export declare function defaultEasing(t: number): number;
12
+ export declare const defaultEasing: (t: number) => number;
13
13
  /** The step of an animated move from `from` to `to`: over `duration` milliseconds (or the options), ease-out by
14
14
  * default, the bearing turning the shortest way round */
15
- export declare function easeTo(engine: Target, from: Camera, to: Camera, options?: number | AnimationOptions): Step;
15
+ export declare const easeTo: (engine: Target, from: Camera, to: Camera, options?: number | AnimationOptions) => Step;
16
16
  /**
17
17
  * 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
18
18
  * MapLibre's `flyTo`): long moves stay readable. Pitch and bearing follow the progress. `viewport`: the larger side of
19
19
  * the canvas, CSS pixels.
20
20
  */
21
- export declare function flyTo(engine: Target, from: Camera, to: Camera, viewport: number, options?: FlyToOptions): Step;
21
+ export declare const flyTo: (engine: Target, from: Camera, to: Camera, viewport: number, options?: FlyToOptions) => Step;
22
22
  export {};
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { fromMercator, toMercator } from "./geo.js";
6
6
  /** MapLibre's default easing: cubic Bézier (0.25, 0.1, 0.25, 1) */
7
- export function defaultEasing(t) {
7
+ export const defaultEasing = (t) => {
8
8
  if (t <= 0 || t >= 1)
9
9
  return Math.max(0, Math.min(1, t));
10
10
  // Solve x(u) = t for the curve parameter, Newton then bisection
@@ -19,10 +19,10 @@ export function defaultEasing(t) {
19
19
  u = Math.max(0, Math.min(1, u - x / dx));
20
20
  }
21
21
  return bezier(u, y1, y2);
22
- }
22
+ };
23
23
  /** The step of an animated move from `from` to `to`: over `duration` milliseconds (or the options), ease-out by
24
24
  * default, the bearing turning the shortest way round */
25
- export function easeTo(engine, from, to, options = 600) {
25
+ export const easeTo = (engine, from, to, options = 600) => {
26
26
  const { duration = 600, easing = (t) => 1 - (1 - t) ** 3 } = typeof options === 'number' ? { duration: options } : options;
27
27
  // Shortest way round
28
28
  const turn = ((to.bearing - from.bearing + 540) % 360) - 180;
@@ -36,13 +36,13 @@ export function easeTo(engine, from, to, options = 600) {
36
36
  engine().setCamera(mix(from.center[0], to.center[0]), mix(from.center[1], to.center[1]), mix(from.zoom, to.zoom), mix(from.pitch, to.pitch), from.bearing + turn * k);
37
37
  return t < 1;
38
38
  };
39
- }
39
+ };
40
40
  /**
41
41
  * 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
42
42
  * MapLibre's `flyTo`): long moves stay readable. Pitch and bearing follow the progress. `viewport`: the larger side of
43
43
  * the canvas, CSS pixels.
44
44
  */
45
- export function flyTo(engine, from, to, viewport, options = {}) {
45
+ export const flyTo = (engine, from, to, viewport, options = {}) => {
46
46
  const { curve: rho = 1.42, speed = 1.2, easing = defaultEasing } = options;
47
47
  const [x0, y0] = toMercator(from.center);
48
48
  const [x1, y1] = toMercator(to.center);
@@ -80,5 +80,5 @@ export function flyTo(engine, from, to, viewport, options = {}) {
80
80
  engine().setCamera(lon, lat, zoom, from.pitch + (to.pitch - from.pitch) * k, from.bearing + turn * k);
81
81
  return t < 1;
82
82
  };
83
- }
83
+ };
84
84
  //# sourceMappingURL=animation.js.map