isard 0.7.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +76 -0
- package/dist/basemap.worker.d.ts +7 -1
- package/dist/basemap.worker.js +2 -2
- package/dist/basemap.worker.js.map +8 -7
- package/dist/basemaps.d.ts +3 -3
- package/dist/basemaps.js +2 -14
- package/dist/basemaps.js.map +1 -1
- package/dist/controls.d.ts +4 -3
- package/dist/controls.js +0 -8
- package/dist/controls.js.map +1 -1
- package/dist/decoder.worker.js +4 -4
- package/dist/decoder.worker.js.map +6 -5
- package/dist/engine-loader.d.ts +12 -5
- package/dist/engine-loader.js +36 -5
- package/dist/engine-loader.js.map +1 -1
- package/dist/geoplateforme.d.ts +51 -1
- package/dist/geoplateforme.js +36 -1
- package/dist/geoplateforme.js.map +1 -1
- package/dist/glyphs.js +2 -1
- package/dist/glyphs.js.map +1 -1
- package/dist/icons.js +5 -1
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/interaction.d.ts +2 -0
- package/dist/interaction.js +29 -2
- package/dist/interaction.js.map +1 -1
- package/dist/isard_bg.wasm +0 -0
- package/dist/isard_core_bg.wasm +0 -0
- package/dist/layers.d.ts +5 -2
- package/dist/layers.js +37 -8
- package/dist/layers.js.map +1 -1
- package/dist/loader.d.ts +2 -0
- package/dist/loader.js +10 -0
- package/dist/loader.js.map +1 -1
- package/dist/map.d.ts +116 -4
- package/dist/map.js +245 -13
- package/dist/map.js.map +1 -1
- package/dist/overlay.d.ts +40 -0
- package/dist/overlay.js +119 -0
- package/dist/overlay.js.map +1 -1
- package/dist/panoramas.d.ts +94 -0
- package/dist/panoramas.js +245 -0
- package/dist/panoramas.js.map +1 -0
- package/dist/pmtiles.js +3 -2
- package/dist/pmtiles.js.map +1 -1
- package/dist/pointclouds.js +1 -1
- package/dist/pointclouds.js.map +1 -1
- package/dist/protocol.d.ts +7 -1
- package/dist/protocol.js.map +1 -1
- package/dist/requests.d.ts +14 -0
- package/dist/requests.js +48 -0
- package/dist/requests.js.map +1 -0
- package/dist/resample.js +2 -1
- package/dist/resample.js.map +1 -1
- package/dist/style.js +1 -0
- package/dist/style.js.map +1 -1
- package/dist/terrain.d.ts +0 -5
- package/dist/terrain.js +2 -1
- package/dist/terrain.js.map +1 -1
- package/dist/types.d.ts +40 -8
- package/dist/types.js.map +1 -1
- package/dist/vectortiles.d.ts +2 -2
- package/dist/vectortiles.js +16 -4
- package/dist/vectortiles.js.map +1 -1
- package/dist/wasm/isard.d.ts +79 -5
- package/dist/wasm/isard.js +165 -7
- package/dist/wasm/isard_core.d.ts +38 -0
- package/dist/wasm/isard_core.js +99 -0
- package/dist/wmts.js +2 -1
- package/dist/wmts.js.map +1 -1
- package/package.json +8 -2
- package/vite.d.ts +17 -0
- package/vite.js +64 -0
package/dist/icons.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../src/icons.ts"],"names":[],"mappings":"AA2DA,6GAA6G;AAC7G,MAAM,UAAU,aAAa,CAAC,MAAoD;IAChF,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACtF,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,GAAG,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACnH,CAAC;AAED,2GAA2G;AAC3G,MAAM,UAAU,UAAU,CAAC,EAAU,EAAE,IAAY;IACjD,OAAO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EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;gBACxD,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC9B,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC9B,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC9B,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AAC3D,CAAC","sourcesContent":["/**\n * Icons for the symbol layers: the images of a style's sprite (MapLibre's sprite format: a JSON index and a PNG sheet,\n * `@2x` on high-density screens, one sprite or several with their ids) and the application's own (`map.addImage`),\n * packed on first use into an RGBA atlas the engine samples (premultiplied: no dark fringe where it is scaled); and the\n * layout of an icon around its anchor: by its anchor and offset, or stretched around its text (`icon-text-fit`), by\n * the stretchable zones and the content box of its image when it has them (`stretchX`, `stretchY`, `content`).\n */\nimport type { Anchor } from './overlay.ts';\nimport type { Engine } from './wasm/isard.js';\n\n/** An image of a sprite's index: its place in the sheet (pixels) and how it is drawn */\nexport interface SpriteIcon {\n x: number;\n y: number;\n width: number;\n height: number;\n /** Image pixels per CSS pixel (default 1; 2 in an `@2x` sheet) */\n pixelRatio?: number;\n /** A signed distance field in alpha, drawn in the icon color */\n sdf?: boolean;\n /** Columns and rows that stretch when the icon is fitted to its text (image pixels): the others keep their size */\n stretchX?: [number, number][];\n stretchY?: [number, number][];\n /** Where the text goes when the icon is fitted to it: left, top, right, bottom (image pixels) */\n content?: [number, number, number, number];\n}\n\nexport type SpriteIndex = Record<string, SpriteIcon>;\n\n/** RGBA pixels, straight alpha, row after row */\nexport interface Pixels {\n width: number;\n height: number;\n data: Uint8Array | Uint8ClampedArray;\n}\n\n/** How an image of the application is drawn (`map.addImage`): `SpriteIcon` without its place */\nexport type ImageOptions = Omit<SpriteIcon, 'x' | 'y' | 'width' | 'height'>;\n\n/** An icon in the atlas: its place (texels) and how it is drawn */\nexport interface Icon {\n x: number;\n y: number;\n width: number;\n height: number;\n pixelRatio: number;\n sdf: boolean;\n stretchX: [number, number][] | undefined;\n stretchY: [number, number][] | undefined;\n content: [number, number, number, number] | undefined;\n}\n\n/** A sprite of a style: its id (`default`: its images keep their names, else `id:name`) and its URL without\n * extension */\nexport interface SpriteSource {\n id: string;\n url: string;\n}\n\n/** The sprites of a style's `sprite`: one URL, or several with their ids (MapLibre's style specification) */\nexport function spriteSources(sprite: string | readonly SpriteSource[] | undefined): SpriteSource[] {\n if (typeof sprite === 'string') return sprite ? [{ id: 'default', url: sprite }] : [];\n return Array.isArray(sprite) ? sprite.filter((s) => typeof s?.url === 'string' && typeof s.id === 'string') : [];\n}\n\n/** The name of an image of a sprite in the style: its own in the `default` sprite, `id:name` in another */\nexport function spriteName(id: string, name: string): string {\n return id === 'default' ? name : `${id}:${name}`;\n}\n\n/** The URL of a sprite's index or sheet: `.json` or `.png`, `@2x` before it for high-density screens, before the\n * query of the URL if it has one */\nexport function spriteFile(url: string, extension: 'json' | 'png', ratio: number): string {\n const suffix = `${ratio > 1 ? '@2x' : ''}.${extension}`;\n const query = url.search(/[?#]/);\n return query < 0 ? `${url}${suffix}` : `${url.slice(0, query)}${suffix}${url.slice(query)}`;\n}\n\n/** A sprite loaded: its images by name (with the sprite's prefix) and its sheet */\nexport interface LoadedSprite {\n icons: SpriteIndex;\n image: ImageBitmap;\n}\n\n/** Loads a style's sprites (`@2x` above a device pixel ratio of 1, the 1x ones if a server has none); the sprites\n * that fail are left out */\nexport async function loadSprites(\n sprite: string | readonly SpriteSource[] | undefined,\n ratio = typeof devicePixelRatio === 'number' ? devicePixelRatio : 1,\n): Promise<LoadedSprite[]> {\n const one = async ({ id, url }: SpriteSource, r: number): Promise<LoadedSprite | undefined> => {\n const [json, png] = await Promise.all([fetch(spriteFile(url, 'json', r)), fetch(spriteFile(url, 'png', r))]);\n if (!json.ok || !png.ok) return r > 1 ? one({ id, url }, 1) : undefined;\n const index = (await json.json()) as SpriteIndex;\n const icons: SpriteIndex = {};\n for (const [name, icon] of Object.entries(index)) icons[spriteName(id, name)] = icon;\n return { icons, image: await createImageBitmap(await png.blob()) };\n };\n const loaded = await Promise.all(spriteSources(sprite).map((s) => one(s, ratio).catch(() => undefined)));\n return loaded.filter((s): s is LoadedSprite => s !== undefined);\n}\n\n/** The pixels of an image (read back through a canvas) */\nexport function readPixels(image: CanvasImageSource & { width: number; height: number }): Pixels | undefined {\n const { width, height } = image;\n if (!(width > 0 && height > 0)) return undefined;\n const canvas =\n typeof OffscreenCanvas === 'function'\n ? new OffscreenCanvas(width, height)\n : Object.assign(document.createElement('canvas'), { width, height });\n const g = canvas.getContext('2d') as CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D | null;\n if (!g) return undefined;\n g.drawImage(image, 0, 0);\n return g.getImageData(0, 0, width, height);\n}\n\n/** Where an icon's pixels are: a region of an image, read when first packed */\ninterface IconSource {\n pixels: () => Pixels | undefined;\n x: number;\n y: number;\n width: number;\n height: number;\n options: ImageOptions;\n}\n\n/** A shelf of the packer: its y, height, and the x of the next free place */\ninterface Shelf {\n y: number;\n height: number;\n x: number;\n}\n\n/** The icons of a map and their atlas: a square that doubles as it fills, up to the texture size limit */\nexport class Icons {\n private size = 256;\n private data = new Uint8Array(256 * 256 * 4);\n private shelves: Shelf[] = [];\n private readonly sources = new Map<string, IconSource>();\n /** Icons packed, null for those that cannot be (no pixels, the atlas full) */\n private readonly packed = new Map<string, Icon | null>();\n private engine: Engine | undefined;\n /** Rows changed since the last upload: first, end */\n private dirty: [number, number] | undefined;\n private full = false;\n private readonly maxSize: number;\n /** Bumped each time icons are added or removed: labels laid out without some of theirs are laid out again */\n version = 0;\n\n /** `maxSize`: the GPU's texture size limit if known (the atlas is at most 4096 × 4096) */\n constructor(maxSize = 4096) {\n this.maxSize = Math.max(256, Math.min(4096, maxSize));\n }\n\n /** Sends the whole atlas to an engine (a new one after a context loss) */\n attach(engine: Engine): void {\n this.engine = engine;\n this.dirty = undefined;\n this.upload();\n }\n\n /** Side of the atlas */\n get atlasSize(): number {\n return this.size;\n }\n\n /** An image of the application under `name` (another image of that name is replaced) */\n add(name: string, pixels: Pixels, options: ImageOptions = {}): void {\n this.define(name, { pixels: () => pixels, x: 0, y: 0, width: pixels.width, height: pixels.height, options });\n }\n\n /** The images of a sprite's index, `prefix` before their names, their pixels read from the sheet on first use */\n addSprite(prefix: string, index: SpriteIndex, sheet: () => Pixels | undefined): void {\n let pixels: Pixels | undefined;\n let read = false;\n const once = () => {\n if (!read) {\n read = true;\n pixels = sheet();\n }\n return pixels;\n };\n for (const [name, icon] of Object.entries(index)) {\n if (!icon || typeof icon !== 'object') continue;\n const { x, y, width, height, ...options } = icon;\n this.define(`${prefix}${name}`, { pixels: once, x, y, width, height, options }, false);\n }\n this.version += 1;\n }\n\n private define(name: string, source: IconSource, bump = true): void {\n this.sources.set(name, source);\n // Packed again on its next use (its old place stays taken)\n this.packed.delete(name);\n if (bump) this.version += 1;\n }\n\n has(name: string): boolean {\n return this.sources.has(name);\n }\n\n /** Forgets an image, or every image whose name starts with `prefix` (a sprite's) */\n remove(name: string, prefix = false): void {\n for (const key of [...this.sources.keys()]) {\n if (prefix ? key.startsWith(name) : key === name) {\n this.sources.delete(key);\n this.packed.delete(key);\n }\n }\n this.version += 1;\n }\n\n /** The icon of this name, packed into the atlas on first use; undefined if there is none (`flush` uploads it) */\n get(name: string): Icon | undefined {\n const hit = this.packed.get(name);\n if (hit !== undefined) return hit ?? undefined;\n const source = this.sources.get(name);\n if (!source) return undefined;\n const icon = this.pack(source);\n this.packed.set(name, icon ?? null);\n return icon;\n }\n\n /** Sends the rows changed since the last upload to the engine */\n flush(): void {\n const dirty = this.dirty;\n this.dirty = undefined;\n if (!dirty || !this.engine) return;\n const [y0, y1] = dirty;\n const row = this.size * 4;\n this.engine.updateIconAtlas(0, y0, this.size, y1 - y0, this.data.subarray(y0 * row, y1 * row));\n }\n\n private upload(): void {\n const engine = this.engine;\n if (!engine) return;\n engine.setIconAtlas(this.size, this.size);\n const used = this.shelves.reduce((m, s) => Math.max(m, s.y + s.height), 0);\n if (used > 0) engine.updateIconAtlas(0, 0, this.size, used, this.data.subarray(0, used * this.size * 4));\n }\n\n /** Copies an icon's pixels into the atlas, premultiplied, with a texel of room around it */\n private pack(source: IconSource): Icon | undefined {\n const pixels = source.pixels();\n const { x, y, width: w, height: h } = source;\n if (!pixels || !(w > 0 && h > 0) || x < 0 || y < 0 || x + w > pixels.width || y + h > pixels.height) {\n return undefined;\n }\n const place = this.place(w + 2, h + 2);\n if (!place) return undefined;\n const [px, py] = [place[0] + 1, place[1] + 1];\n for (let row = 0; row < h; row += 1) {\n for (let col = 0; col < w; col += 1) {\n const from = ((y + row) * pixels.width + x + col) * 4;\n const to = ((py + row) * this.size + px + col) * 4;\n const a = pixels.data[from + 3] ?? 0;\n this.data[to] = ((pixels.data[from] ?? 0) * a + 127) / 255;\n this.data[to + 1] = ((pixels.data[from + 1] ?? 0) * a + 127) / 255;\n this.data[to + 2] = ((pixels.data[from + 2] ?? 0) * a + 127) / 255;\n this.data[to + 3] = a;\n }\n }\n const [d0, d1] = this.dirty ?? [place[1], place[1]];\n this.dirty = [Math.min(d0, place[1]), Math.max(d1, place[1] + h + 2)];\n const { pixelRatio, sdf, stretchX, stretchY, content } = source.options;\n return {\n x: px,\n y: py,\n width: w,\n height: h,\n pixelRatio: pixelRatio && pixelRatio > 0 ? pixelRatio : 1,\n sdf: sdf === true,\n stretchX: Array.isArray(stretchX) ? stretchX : undefined,\n stretchY: Array.isArray(stretchY) ? stretchY : undefined,\n content: Array.isArray(content) && content.length === 4 ? content : undefined,\n };\n }\n\n /** A free place of `w` × `h` texels (shelves, the atlas doubled when full); undefined once it cannot grow */\n private place(w: number, h: number): [number, number] | undefined {\n for (;;) {\n const shelf = this.shelves.find((s) => s.height >= h && s.height <= h + 8 && s.x + w <= this.size);\n if (shelf) {\n shelf.x += w;\n return [shelf.x - w, shelf.y];\n }\n const last = this.shelves.at(-1);\n const y = last ? last.y + last.height : 0;\n if (y + h <= this.size && w <= this.size) {\n this.shelves.push({ y, height: h, x: w });\n return [0, y];\n }\n if (this.size * 2 > this.maxSize) {\n if (!this.full) console.warn(`isard: the icon atlas is full (${this.size} × ${this.size})`);\n this.full = true;\n return undefined;\n }\n this.grow();\n }\n }\n\n /** Doubles the atlas; the icons keep their places (texels) */\n private grow(): void {\n const size = this.size * 2;\n const data = new Uint8Array(size * size * 4);\n for (let row = 0; row < this.size; row += 1) {\n data.set(this.data.subarray(row * this.size * 4, (row + 1) * this.size * 4), row * size * 4);\n }\n this.size = size;\n this.data = data;\n this.dirty = undefined;\n this.upload();\n }\n}\n\n/** How an icon is laid out around its anchor */\nexport interface IconLayoutOptions {\n /** Scale of the image (`icon-size`) */\n size: number;\n anchor: Anchor;\n /** CSS pixels at size 1 */\n offset: [number, number];\n /** Degrees, clockwise */\n rotate: number;\n /** Stretched around the text: its width, its height, both (`icon-text-fit`) */\n fit: 'none' | 'width' | 'height' | 'both';\n /** Room around the text when fitted: top, right, bottom, left (CSS pixels) */\n padding: [number, number, number, number];\n /** The text's box around the anchor (CSS pixels), if it has one */\n text?: [number, number, number, number] | undefined;\n}\n\n/** An icon laid out: its quads (x, y, width, height in CSS pixels from the anchor, atlas u0, v0, u1, v1 in texels, -1\n * or -2 for a distance field, turn in radians) and its box from the anchor */\nexport interface IconLayout {\n quads: number[][];\n box: [number, number, number, number];\n}\n\n/** Pieces of an image along one axis: image start, end, laid out start, end */\ntype Pieces = [number, number, number, number][];\n\n/**\n * An axis of an icon fitted to `lo`…`hi` (CSS pixels): its content (the whole image by default) spans them, its\n * stretchable zones (the whole image by default) taking the room the fixed parts (at `scale` CSS pixels per image\n * pixel) leave\n */\nexport function stretch(\n length: number,\n zones: readonly [number, number][] | undefined,\n content: [number, number] | undefined,\n lo: number,\n hi: number,\n scale: number,\n): Pieces {\n const clamp = (v: number) => Math.max(0, Math.min(length, Number(v) || 0));\n const spans = (zones?.length ? zones : [[0, length] as [number, number]])\n .map(([a, b]): [number, number] => [clamp(Math.min(a, b)), clamp(Math.max(a, b))])\n .filter(([a, b]) => b > a);\n const cuts = [...new Set([0, length, ...spans.flat()])].sort((a, b) => a - b);\n const pieces = cuts.slice(1).map((b, i): [number, number, boolean] => {\n const a = cuts[i] ?? 0;\n return [a, b, spans.some(([s, e]) => s <= a && b <= e)];\n });\n const [c0, c1] = content ? [clamp(content[0]), clamp(content[1])] : [0, length];\n const overlap = (a: number, b: number) => Math.max(0, Math.min(b, c1) - Math.max(a, c0));\n const stretchable = pieces.reduce((n, [a, b, s]) => n + (s ? overlap(a, b) : 0), 0);\n const fixed = c1 - c0 - stretchable;\n // CSS pixels per stretchable image pixel: what the fixed parts of the content leave of the room\n const k = stretchable > 0 ? Math.max(0, (hi - lo - fixed * scale) / stretchable) : scale;\n // Laid out position of an image coordinate\n const at = (x: number) => pieces.reduce((n, [a, b, s]) => n + Math.max(0, Math.min(x, b) - a) * (s ? k : scale), 0);\n const origin = lo - at(c0);\n return pieces.map(([a, b]) => [a, b, origin + at(a), origin + at(b)]);\n}\n\n/** Where an anchor's side lies along an axis of the icon: at its start 0, at its end 1, else the middle */\nfunction align(start: boolean, end: boolean): number {\n if (start) return 0;\n return end ? 1 : 0.5;\n}\n\n/** Lays an icon out around its anchor: placed by its anchor and offset, or fitted to its text */\nexport function layoutIcon(icon: Icon, options: IconLayoutOptions): IconLayout {\n const { size, anchor, offset, rotate, fit, padding, text } = options;\n const { width: w, height: h, pixelRatio } = icon;\n let xs: Pieces;\n let ys: Pieces;\n if (fit !== 'none' && text) {\n const [top, right, bottom, left] = padding;\n const [x0, y0, x1, y1] = [text[0] - left, text[1] - top, text[2] + right, text[3] + bottom];\n // The fixed parts at the image's own size; an axis not fitted at the icon's size, centered on the text\n const own = 1 / pixelRatio;\n const scaled = size / pixelRatio;\n const centered = (length: number, lo: number, hi: number): Pieces => {\n const c = (lo + hi) / 2;\n return [[0, length, c - (length * scaled) / 2, c + (length * scaled) / 2]];\n };\n const content = icon.content;\n xs =\n fit === 'height'\n ? centered(w, x0, x1)\n : stretch(w, icon.stretchX, content && [content[0], content[2]], x0, x1, own);\n ys =\n fit === 'width'\n ? centered(h, y0, y1)\n : stretch(h, icon.stretchY, content && [content[1], content[3]], y0, y1, own);\n } else {\n const [dw, dh] = [(w / pixelRatio) * size, (h / pixelRatio) * size];\n const ax = align(anchor.includes('left'), anchor.includes('right'));\n const ay = align(anchor.startsWith('top'), anchor.startsWith('bottom'));\n const [left, top] = [offset[0] * size - dw * ax, offset[1] * size - dh * ay];\n xs = [[0, w, left, left + dw]];\n ys = [[0, h, top, top + dh]];\n }\n const angle = ((Number(rotate) || 0) * Math.PI) / 180;\n const kind = icon.sdf ? -2 : -1;\n const quads: number[][] = [];\n const [cs, sn] = [Math.cos(angle), Math.sin(angle)];\n const box: [number, number, number, number] = [\n Number.POSITIVE_INFINITY,\n Number.POSITIVE_INFINITY,\n Number.NEGATIVE_INFINITY,\n Number.NEGATIVE_INFINITY,\n ];\n for (const [v0, v1, top, bottom] of ys) {\n for (const [u0, u1, left, right] of xs) {\n if (right <= left || bottom <= top) continue;\n quads.push([\n left,\n top,\n right - left,\n bottom - top,\n icon.x + u0,\n icon.y + v0,\n icon.x + u1,\n icon.y + v1,\n kind,\n angle,\n ]);\n // The box of the turned corners\n for (const [px, py] of [\n [left, top],\n [right, top],\n [left, bottom],\n [right, bottom],\n ] as const) {\n const [rx, ry] = [px * cs - py * sn, px * sn + py * cs];\n box[0] = Math.min(box[0], rx);\n box[1] = Math.min(box[1], ry);\n box[2] = Math.max(box[2], rx);\n box[3] = Math.max(box[3], ry);\n }\n }\n }\n return { quads, box: quads.length ? box : [0, 0, 0, 0] };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../src/icons.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAoD5C,6GAA6G;AAC7G,MAAM,UAAU,aAAa,CAAC,MAAoD;IAChF,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACtF,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,GAAG,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACnH,CAAC;AAED,2GAA2G;AAC3G,MAAM,UAAU,UAAU,CAAC,EAAU,EAAE,IAAY;IACjD,OAAO,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,IAAI,EAAE,CAAC;AACnD,CAAC;AAED;oCACoC;AACpC,MAAM,UAAU,UAAU,CAAC,GAAW,EAAE,SAAyB,EAAE,KAAa;IAC9E,MAAM,MAAM,GAAG,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,SAAS,EAAE,CAAC;IACxD,MAAM,KA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gBAC9B,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC9B,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC9B,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AAC3D,CAAC","sourcesContent":["/**\n * Icons for the symbol layers: the images of a style's sprite (MapLibre's sprite format: a JSON index and a PNG sheet,\n * `@2x` on high-density screens, one sprite or several with their ids) and the application's own (`map.addImage`),\n * packed on first use into an RGBA atlas the engine samples (premultiplied: no dark fringe where it is scaled); and the\n * layout of an icon around its anchor: by its anchor and offset, or stretched around its text (`icon-text-fit`), by\n * the stretchable zones and the content box of its image when it has them (`stretchX`, `stretchY`, `content`).\n */\nimport type { Anchor } from './overlay.ts';\nimport { withHeaders } from './requests.ts';\nimport type { Engine } from './wasm/isard.js';\n\n/** An image of a sprite's index: its place in the sheet (pixels) and how it is drawn */\nexport interface SpriteIcon {\n x: number;\n y: number;\n width: number;\n height: number;\n /** Image pixels per CSS pixel (default 1; 2 in an `@2x` sheet) */\n pixelRatio?: number;\n /** A signed distance field in alpha, drawn in the icon color */\n sdf?: boolean;\n /** Columns and rows that stretch when the icon is fitted to its text (image pixels): the others keep their size */\n stretchX?: [number, number][];\n stretchY?: [number, number][];\n /** Where the text goes when the icon is fitted to it: left, top, right, bottom (image pixels) */\n content?: [number, number, number, number];\n}\n\nexport type SpriteIndex = Record<string, SpriteIcon>;\n\n/** RGBA pixels, straight alpha, row after row */\nexport interface Pixels {\n width: number;\n height: number;\n data: Uint8Array | Uint8ClampedArray;\n}\n\n/** How an image of the application is drawn (`map.addImage`): `SpriteIcon` without its place */\nexport type ImageOptions = Omit<SpriteIcon, 'x' | 'y' | 'width' | 'height'>;\n\n/** An icon in the atlas: its place (texels) and how it is drawn */\nexport interface Icon {\n x: number;\n y: number;\n width: number;\n height: number;\n pixelRatio: number;\n sdf: boolean;\n stretchX: [number, number][] | undefined;\n stretchY: [number, number][] | undefined;\n content: [number, number, number, number] | undefined;\n}\n\n/** A sprite of a style: its id (`default`: its images keep their names, else `id:name`) and its URL without\n * extension */\nexport interface SpriteSource {\n id: string;\n url: string;\n}\n\n/** The sprites of a style's `sprite`: one URL, or several with their ids (MapLibre's style specification) */\nexport function spriteSources(sprite: string | readonly SpriteSource[] | undefined): SpriteSource[] {\n if (typeof sprite === 'string') return sprite ? [{ id: 'default', url: sprite }] : [];\n return Array.isArray(sprite) ? sprite.filter((s) => typeof s?.url === 'string' && typeof s.id === 'string') : [];\n}\n\n/** The name of an image of a sprite in the style: its own in the `default` sprite, `id:name` in another */\nexport function spriteName(id: string, name: string): string {\n return id === 'default' ? name : `${id}:${name}`;\n}\n\n/** The URL of a sprite's index or sheet: `.json` or `.png`, `@2x` before it for high-density screens, before the\n * query of the URL if it has one */\nexport function spriteFile(url: string, extension: 'json' | 'png', ratio: number): string {\n const suffix = `${ratio > 1 ? '@2x' : ''}.${extension}`;\n const query = url.search(/[?#]/);\n return query < 0 ? `${url}${suffix}` : `${url.slice(0, query)}${suffix}${url.slice(query)}`;\n}\n\n/** A sprite loaded: its images by name (with the sprite's prefix) and its sheet */\nexport interface LoadedSprite {\n icons: SpriteIndex;\n image: ImageBitmap;\n}\n\n/** Loads a style's sprites (`@2x` above a device pixel ratio of 1, the 1x ones if a server has none); the sprites\n * that fail are left out */\nexport async function loadSprites(\n sprite: string | readonly SpriteSource[] | undefined,\n ratio = typeof devicePixelRatio === 'number' ? devicePixelRatio : 1,\n): Promise<LoadedSprite[]> {\n const one = async ({ id, url }: SpriteSource, r: number): Promise<LoadedSprite | undefined> => {\n const [json, png] = await Promise.all([\n fetch(spriteFile(url, 'json', r), withHeaders(spriteFile(url, 'json', r))),\n fetch(spriteFile(url, 'png', r), withHeaders(spriteFile(url, 'png', r))),\n ]);\n if (!json.ok || !png.ok) return r > 1 ? one({ id, url }, 1) : undefined;\n const index = (await json.json()) as SpriteIndex;\n const icons: SpriteIndex = {};\n for (const [name, icon] of Object.entries(index)) icons[spriteName(id, name)] = icon;\n return { icons, image: await createImageBitmap(await png.blob()) };\n };\n const loaded = await Promise.all(spriteSources(sprite).map((s) => one(s, ratio).catch(() => undefined)));\n return loaded.filter((s): s is LoadedSprite => s !== undefined);\n}\n\n/** The pixels of an image (read back through a canvas) */\nexport function readPixels(image: CanvasImageSource & { width: number; height: number }): Pixels | undefined {\n const { width, height } = image;\n if (!(width > 0 && height > 0)) return undefined;\n const canvas =\n typeof OffscreenCanvas === 'function'\n ? new OffscreenCanvas(width, height)\n : Object.assign(document.createElement('canvas'), { width, height });\n const g = canvas.getContext('2d') as CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D | null;\n if (!g) return undefined;\n g.drawImage(image, 0, 0);\n return g.getImageData(0, 0, width, height);\n}\n\n/** Where an icon's pixels are: a region of an image, read when first packed */\ninterface IconSource {\n pixels: () => Pixels | undefined;\n x: number;\n y: number;\n width: number;\n height: number;\n options: ImageOptions;\n}\n\n/** A shelf of the packer: its y, height, and the x of the next free place */\ninterface Shelf {\n y: number;\n height: number;\n x: number;\n}\n\n/** The icons of a map and their atlas: a square that doubles as it fills, up to the texture size limit */\nexport class Icons {\n private size = 256;\n private data = new Uint8Array(256 * 256 * 4);\n private shelves: Shelf[] = [];\n private readonly sources = new Map<string, IconSource>();\n /** Icons packed, null for those that cannot be (no pixels, the atlas full) */\n private readonly packed = new Map<string, Icon | null>();\n private engine: Engine | undefined;\n /** Rows changed since the last upload: first, end */\n private dirty: [number, number] | undefined;\n private full = false;\n private readonly maxSize: number;\n /** Bumped each time icons are added or removed: labels laid out without some of theirs are laid out again */\n version = 0;\n\n /** `maxSize`: the GPU's texture size limit if known (the atlas is at most 4096 × 4096) */\n constructor(maxSize = 4096) {\n this.maxSize = Math.max(256, Math.min(4096, maxSize));\n }\n\n /** Sends the whole atlas to an engine (a new one after a context loss) */\n attach(engine: Engine): void {\n this.engine = engine;\n this.dirty = undefined;\n this.upload();\n }\n\n /** Side of the atlas */\n get atlasSize(): number {\n return this.size;\n }\n\n /** An image of the application under `name` (another image of that name is replaced) */\n add(name: string, pixels: Pixels, options: ImageOptions = {}): void {\n this.define(name, { pixels: () => pixels, x: 0, y: 0, width: pixels.width, height: pixels.height, options });\n }\n\n /** The images of a sprite's index, `prefix` before their names, their pixels read from the sheet on first use */\n addSprite(prefix: string, index: SpriteIndex, sheet: () => Pixels | undefined): void {\n let pixels: Pixels | undefined;\n let read = false;\n const once = () => {\n if (!read) {\n read = true;\n pixels = sheet();\n }\n return pixels;\n };\n for (const [name, icon] of Object.entries(index)) {\n if (!icon || typeof icon !== 'object') continue;\n const { x, y, width, height, ...options } = icon;\n this.define(`${prefix}${name}`, { pixels: once, x, y, width, height, options }, false);\n }\n this.version += 1;\n }\n\n private define(name: string, source: IconSource, bump = true): void {\n this.sources.set(name, source);\n // Packed again on its next use (its old place stays taken)\n this.packed.delete(name);\n if (bump) this.version += 1;\n }\n\n has(name: string): boolean {\n return this.sources.has(name);\n }\n\n /** Forgets an image, or every image whose name starts with `prefix` (a sprite's) */\n remove(name: string, prefix = false): void {\n for (const key of [...this.sources.keys()]) {\n if (prefix ? key.startsWith(name) : key === name) {\n this.sources.delete(key);\n this.packed.delete(key);\n }\n }\n this.version += 1;\n }\n\n /** The icon of this name, packed into the atlas on first use; undefined if there is none (`flush` uploads it) */\n get(name: string): Icon | undefined {\n const hit = this.packed.get(name);\n if (hit !== undefined) return hit ?? undefined;\n const source = this.sources.get(name);\n if (!source) return undefined;\n const icon = this.pack(source);\n this.packed.set(name, icon ?? null);\n return icon;\n }\n\n /** Sends the rows changed since the last upload to the engine */\n flush(): void {\n const dirty = this.dirty;\n this.dirty = undefined;\n if (!dirty || !this.engine) return;\n const [y0, y1] = dirty;\n const row = this.size * 4;\n this.engine.updateIconAtlas(0, y0, this.size, y1 - y0, this.data.subarray(y0 * row, y1 * row));\n }\n\n private upload(): void {\n const engine = this.engine;\n if (!engine) return;\n engine.setIconAtlas(this.size, this.size);\n const used = this.shelves.reduce((m, s) => Math.max(m, s.y + s.height), 0);\n if (used > 0) engine.updateIconAtlas(0, 0, this.size, used, this.data.subarray(0, used * this.size * 4));\n }\n\n /** Copies an icon's pixels into the atlas, premultiplied, with a texel of room around it */\n private pack(source: IconSource): Icon | undefined {\n const pixels = source.pixels();\n const { x, y, width: w, height: h } = source;\n if (!pixels || !(w > 0 && h > 0) || x < 0 || y < 0 || x + w > pixels.width || y + h > pixels.height) {\n return undefined;\n }\n const place = this.place(w + 2, h + 2);\n if (!place) return undefined;\n const [px, py] = [place[0] + 1, place[1] + 1];\n for (let row = 0; row < h; row += 1) {\n for (let col = 0; col < w; col += 1) {\n const from = ((y + row) * pixels.width + x + col) * 4;\n const to = ((py + row) * this.size + px + col) * 4;\n const a = pixels.data[from + 3] ?? 0;\n this.data[to] = ((pixels.data[from] ?? 0) * a + 127) / 255;\n this.data[to + 1] = ((pixels.data[from + 1] ?? 0) * a + 127) / 255;\n this.data[to + 2] = ((pixels.data[from + 2] ?? 0) * a + 127) / 255;\n this.data[to + 3] = a;\n }\n }\n const [d0, d1] = this.dirty ?? [place[1], place[1]];\n this.dirty = [Math.min(d0, place[1]), Math.max(d1, place[1] + h + 2)];\n const { pixelRatio, sdf, stretchX, stretchY, content } = source.options;\n return {\n x: px,\n y: py,\n width: w,\n height: h,\n pixelRatio: pixelRatio && pixelRatio > 0 ? pixelRatio : 1,\n sdf: sdf === true,\n stretchX: Array.isArray(stretchX) ? stretchX : undefined,\n stretchY: Array.isArray(stretchY) ? stretchY : undefined,\n content: Array.isArray(content) && content.length === 4 ? content : undefined,\n };\n }\n\n /** A free place of `w` × `h` texels (shelves, the atlas doubled when full); undefined once it cannot grow */\n private place(w: number, h: number): [number, number] | undefined {\n for (;;) {\n const shelf = this.shelves.find((s) => s.height >= h && s.height <= h + 8 && s.x + w <= this.size);\n if (shelf) {\n shelf.x += w;\n return [shelf.x - w, shelf.y];\n }\n const last = this.shelves.at(-1);\n const y = last ? last.y + last.height : 0;\n if (y + h <= this.size && w <= this.size) {\n this.shelves.push({ y, height: h, x: w });\n return [0, y];\n }\n if (this.size * 2 > this.maxSize) {\n if (!this.full) console.warn(`isard: the icon atlas is full (${this.size} × ${this.size})`);\n this.full = true;\n return undefined;\n }\n this.grow();\n }\n }\n\n /** Doubles the atlas; the icons keep their places (texels) */\n private grow(): void {\n const size = this.size * 2;\n const data = new Uint8Array(size * size * 4);\n for (let row = 0; row < this.size; row += 1) {\n data.set(this.data.subarray(row * this.size * 4, (row + 1) * this.size * 4), row * size * 4);\n }\n this.size = size;\n this.data = data;\n this.dirty = undefined;\n this.upload();\n }\n}\n\n/** How an icon is laid out around its anchor */\nexport interface IconLayoutOptions {\n /** Scale of the image (`icon-size`) */\n size: number;\n anchor: Anchor;\n /** CSS pixels at size 1 */\n offset: [number, number];\n /** Degrees, clockwise */\n rotate: number;\n /** Stretched around the text: its width, its height, both (`icon-text-fit`) */\n fit: 'none' | 'width' | 'height' | 'both';\n /** Room around the text when fitted: top, right, bottom, left (CSS pixels) */\n padding: [number, number, number, number];\n /** The text's box around the anchor (CSS pixels), if it has one */\n text?: [number, number, number, number] | undefined;\n}\n\n/** An icon laid out: its quads (x, y, width, height in CSS pixels from the anchor, atlas u0, v0, u1, v1 in texels, -1\n * or -2 for a distance field, turn in radians) and its box from the anchor */\nexport interface IconLayout {\n quads: number[][];\n box: [number, number, number, number];\n}\n\n/** Pieces of an image along one axis: image start, end, laid out start, end */\ntype Pieces = [number, number, number, number][];\n\n/**\n * An axis of an icon fitted to `lo`…`hi` (CSS pixels): its content (the whole image by default) spans them, its\n * stretchable zones (the whole image by default) taking the room the fixed parts (at `scale` CSS pixels per image\n * pixel) leave\n */\nexport function stretch(\n length: number,\n zones: readonly [number, number][] | undefined,\n content: [number, number] | undefined,\n lo: number,\n hi: number,\n scale: number,\n): Pieces {\n const clamp = (v: number) => Math.max(0, Math.min(length, Number(v) || 0));\n const spans = (zones?.length ? zones : [[0, length] as [number, number]])\n .map(([a, b]): [number, number] => [clamp(Math.min(a, b)), clamp(Math.max(a, b))])\n .filter(([a, b]) => b > a);\n const cuts = [...new Set([0, length, ...spans.flat()])].sort((a, b) => a - b);\n const pieces = cuts.slice(1).map((b, i): [number, number, boolean] => {\n const a = cuts[i] ?? 0;\n return [a, b, spans.some(([s, e]) => s <= a && b <= e)];\n });\n const [c0, c1] = content ? [clamp(content[0]), clamp(content[1])] : [0, length];\n const overlap = (a: number, b: number) => Math.max(0, Math.min(b, c1) - Math.max(a, c0));\n const stretchable = pieces.reduce((n, [a, b, s]) => n + (s ? overlap(a, b) : 0), 0);\n const fixed = c1 - c0 - stretchable;\n // CSS pixels per stretchable image pixel: what the fixed parts of the content leave of the room\n const k = stretchable > 0 ? Math.max(0, (hi - lo - fixed * scale) / stretchable) : scale;\n // Laid out position of an image coordinate\n const at = (x: number) => pieces.reduce((n, [a, b, s]) => n + Math.max(0, Math.min(x, b) - a) * (s ? k : scale), 0);\n const origin = lo - at(c0);\n return pieces.map(([a, b]) => [a, b, origin + at(a), origin + at(b)]);\n}\n\n/** Where an anchor's side lies along an axis of the icon: at its start 0, at its end 1, else the middle */\nfunction align(start: boolean, end: boolean): number {\n if (start) return 0;\n return end ? 1 : 0.5;\n}\n\n/** Lays an icon out around its anchor: placed by its anchor and offset, or fitted to its text */\nexport function layoutIcon(icon: Icon, options: IconLayoutOptions): IconLayout {\n const { size, anchor, offset, rotate, fit, padding, text } = options;\n const { width: w, height: h, pixelRatio } = icon;\n let xs: Pieces;\n let ys: Pieces;\n if (fit !== 'none' && text) {\n const [top, right, bottom, left] = padding;\n const [x0, y0, x1, y1] = [text[0] - left, text[1] - top, text[2] + right, text[3] + bottom];\n // The fixed parts at the image's own size; an axis not fitted at the icon's size, centered on the text\n const own = 1 / pixelRatio;\n const scaled = size / pixelRatio;\n const centered = (length: number, lo: number, hi: number): Pieces => {\n const c = (lo + hi) / 2;\n return [[0, length, c - (length * scaled) / 2, c + (length * scaled) / 2]];\n };\n const content = icon.content;\n xs =\n fit === 'height'\n ? centered(w, x0, x1)\n : stretch(w, icon.stretchX, content && [content[0], content[2]], x0, x1, own);\n ys =\n fit === 'width'\n ? centered(h, y0, y1)\n : stretch(h, icon.stretchY, content && [content[1], content[3]], y0, y1, own);\n } else {\n const [dw, dh] = [(w / pixelRatio) * size, (h / pixelRatio) * size];\n const ax = align(anchor.includes('left'), anchor.includes('right'));\n const ay = align(anchor.startsWith('top'), anchor.startsWith('bottom'));\n const [left, top] = [offset[0] * size - dw * ax, offset[1] * size - dh * ay];\n xs = [[0, w, left, left + dw]];\n ys = [[0, h, top, top + dh]];\n }\n const angle = ((Number(rotate) || 0) * Math.PI) / 180;\n const kind = icon.sdf ? -2 : -1;\n const quads: number[][] = [];\n const [cs, sn] = [Math.cos(angle), Math.sin(angle)];\n const box: [number, number, number, number] = [\n Number.POSITIVE_INFINITY,\n Number.POSITIVE_INFINITY,\n Number.NEGATIVE_INFINITY,\n Number.NEGATIVE_INFINITY,\n ];\n for (const [v0, v1, top, bottom] of ys) {\n for (const [u0, u1, left, right] of xs) {\n if (right <= left || bottom <= top) continue;\n quads.push([\n left,\n top,\n right - left,\n bottom - top,\n icon.x + u0,\n icon.y + v0,\n icon.x + u1,\n icon.y + v1,\n kind,\n angle,\n ]);\n // The box of the turned corners\n for (const [px, py] of [\n [left, top],\n [right, top],\n [left, bottom],\n [right, bottom],\n ] as const) {\n const [rx, ry] = [px * cs - py * sn, px * sn + py * cs];\n box[0] = Math.min(box[0], rx);\n box[1] = Math.min(box[1], ry);\n box[2] = Math.max(box[2], rx);\n box[3] = Math.max(box[3], ry);\n }\n }\n }\n return { quads, box: quads.length ? box : [0, 0, 0, 0] };\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
export { OPENFREEMAP_ATTRIBUTION, TERRAIN_TILES_ATTRIBUTION } from './basemaps.ts';
|
|
15
|
-
export { AttributionControl, type AttributionOptions, type Control, type ControlPosition,
|
|
15
|
+
export { AttributionControl, type AttributionOptions, type Control, type ControlPosition, NavigationControl, type NavigationOptions, } from './controls.ts';
|
|
16
16
|
export { type Crs, type CrsLike, getCrs, lambertConformalConic, registerCrs, reproject, transverseMercator, } from './crs.ts';
|
|
17
17
|
export type { DecoderUrls } from './decoders.ts';
|
|
18
18
|
export type { ExtrusionOptions, ExtrusionStyle, PolygonArrays, TileKey } from './extrusions.ts';
|
|
19
19
|
export { ExtrusionLayer } from './extrusions.ts';
|
|
20
20
|
export type { CircleOptions, CircleStyle, Feature, FeatureCollection, FeatureData, FeatureLayerStyle, FillOptions, FillStyle, Geometry, LineOptions, LineStyle, Placement, Position, Properties, Ramp, Size, Stops, Styled, } from './features.ts';
|
|
21
21
|
export { CircleLayer, FeatureLayer, FillLayer, interpolate, LineLayer, parseColor } from './features.ts';
|
|
22
|
-
export { geoplateformeWfs, geoplateformeWms, geoplateformeWmts, IGN_ATTRIBUTION } from './geoplateforme.ts';
|
|
22
|
+
export { BATIMENTS_3D_URL, type BdTopoBuilding, batiments3d, bdtopoBuildings, geoplateformeWfs, geoplateformeWms, geoplateformeWmts, IGN_ATTRIBUTION, IGN_PRESETS, type IgnPreset, } from './geoplateforme.ts';
|
|
23
23
|
export type { TextPart } from './glyphs.ts';
|
|
24
24
|
export { DEFAULT_FONT, GLYPHS_URL } from './glyphs.ts';
|
|
25
25
|
export { parseGpx } from './gpx.ts';
|
|
@@ -28,15 +28,17 @@ export type { ImageOptions, Pixels, SpriteIcon } from './icons.ts';
|
|
|
28
28
|
export { parseKml } from './kml.ts';
|
|
29
29
|
export type { CustomFrame, CustomLayerInterface, GroundOptions, GroundTexture, ModelInstance, ModelOptions, } from './layers.ts';
|
|
30
30
|
export { CustomLayer, GroundLayer, Layer, ModelLayer, NetworkLayer, RasterLayer, Tiles3dLayer, } from './layers.ts';
|
|
31
|
-
export { GeoMap } from './map.ts';
|
|
32
|
-
export { type Anchor, Marker, type MarkerEvent, type MarkerEvents, type MarkerOptions, Popup, type PopupEvents, type PopupOptions, } from './overlay.ts';
|
|
31
|
+
export { GeoMap, type LayerSpec } from './map.ts';
|
|
32
|
+
export { type Anchor, Marker, type MarkerEvent, type MarkerEvents, type MarkerOptions, Panel, type PanelOptions, Popup, type PopupEvents, type PopupOptions, } from './overlay.ts';
|
|
33
|
+
export { type Panorama, type PanoramaOptions, Panoramas } from './panoramas.ts';
|
|
33
34
|
export { PMTiles, type PmtilesEntry, type PmtilesHeader, type PmtilesTileType, tileIdToZxy, zxyToTileId, } from './pmtiles.ts';
|
|
34
35
|
export type { ClassStyle, PointCloudOptions, PointCloudStyle, PointColor } from './pointclouds.ts';
|
|
35
36
|
export { CLASSIFICATIONS, ELEVATION_RAMP, PointCloudLayer } from './pointclouds.ts';
|
|
37
|
+
export { setRequestHeaders } from './requests.ts';
|
|
36
38
|
export type { Overlap, SymbolOptions, SymbolStyle } from './symbols.ts';
|
|
37
39
|
export { SymbolLayer } from './symbols.ts';
|
|
38
40
|
export { parseTopoJson, type TopoGeometry, type Topology } from './topojson.ts';
|
|
39
|
-
export type { AnimationOptions, AtmosphereOptions, Basemap, BasemapName, BodyOptions, CelestialBody, FeatureHit, FlyToOptions, GeoMapOptions,
|
|
41
|
+
export type { AnimationOptions, AtmosphereOptions, Basemap, BasemapName, BodyOptions, CelestialBody, FeatureHit, FirstPersonView, FlyToOptions, GeoMapOptions, LoadingMode, LonLat, MapEvents, MapHoverFeatureEvent, MapPointerEvent, NetworkOptions, NetworkStyle, Point, Projection, RasterGrid, RasterOptions, RasterStyle, SwipeOptions, TerrainEncoding, TerrainModel, TerrainOptions, Tiles3dOptions, Tiles3dStyle, ViewshedOptions, } from './types.ts';
|
|
40
42
|
export type { CandidateIcon, CandidateOverlap, Json, LabelCandidate, RasterSource, Style, StyleLayer, } from './vectorstyle.ts';
|
|
41
43
|
export type { PmtilesOptions, VectorTilesOptions } from './vectortiles.ts';
|
|
42
44
|
export { basicStyle, OPENFREEMAP_STYLES, PLAN_STYLES, VectorTiles } from './vectortiles.ts';
|
package/dist/index.js
CHANGED
|
@@ -12,19 +12,21 @@
|
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
export { OPENFREEMAP_ATTRIBUTION, TERRAIN_TILES_ATTRIBUTION } from "./basemaps.js";
|
|
15
|
-
export { AttributionControl,
|
|
15
|
+
export { AttributionControl, NavigationControl, } from "./controls.js";
|
|
16
16
|
export { getCrs, lambertConformalConic, registerCrs, reproject, transverseMercator, } from "./crs.js";
|
|
17
17
|
export { ExtrusionLayer } from "./extrusions.js";
|
|
18
18
|
export { CircleLayer, FeatureLayer, FillLayer, interpolate, LineLayer, parseColor } from "./features.js";
|
|
19
|
-
export { geoplateformeWfs, geoplateformeWms, geoplateformeWmts, IGN_ATTRIBUTION } from "./geoplateforme.js";
|
|
19
|
+
export { BATIMENTS_3D_URL, batiments3d, bdtopoBuildings, geoplateformeWfs, geoplateformeWms, geoplateformeWmts, IGN_ATTRIBUTION, IGN_PRESETS, } from "./geoplateforme.js";
|
|
20
20
|
export { DEFAULT_FONT, GLYPHS_URL } from "./glyphs.js";
|
|
21
21
|
export { parseGpx } from "./gpx.js";
|
|
22
22
|
export { parseKml } from "./kml.js";
|
|
23
23
|
export { CustomLayer, GroundLayer, Layer, ModelLayer, NetworkLayer, RasterLayer, Tiles3dLayer, } from "./layers.js";
|
|
24
24
|
export { GeoMap } from "./map.js";
|
|
25
|
-
export { Marker, Popup, } from "./overlay.js";
|
|
25
|
+
export { Marker, Panel, Popup, } from "./overlay.js";
|
|
26
|
+
export { Panoramas } from "./panoramas.js";
|
|
26
27
|
export { PMTiles, tileIdToZxy, zxyToTileId, } from "./pmtiles.js";
|
|
27
28
|
export { CLASSIFICATIONS, ELEVATION_RAMP, PointCloudLayer } from "./pointclouds.js";
|
|
29
|
+
export { setRequestHeaders } from "./requests.js";
|
|
28
30
|
export { SymbolLayer } from "./symbols.js";
|
|
29
31
|
export { parseTopoJson } from "./topojson.js";
|
|
30
32
|
export { basicStyle, OPENFREEMAP_STYLES, PLAN_STYLES, VectorTiles } from "./vectortiles.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EACL,kBAAkB,EAIlB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EACL,kBAAkB,EAIlB,iBAAiB,GAElB,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,MAAM,EACN,qBAAqB,EACrB,WAAW,EACX,SAAS,EACT,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAqBjD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACzG,OAAO,EACL,gBAAgB,EAEhB,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,WAAW,GAEZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AASpC,OAAO,EACL,WAAW,EACX,WAAW,EACX,KAAK,EACL,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAkB,MAAM,UAAU,CAAC;AAClD,OAAO,EAEL,MAAM,EAIN,KAAK,EAEL,KAAK,GAGN,MAAM,cAAc,CAAC;AACtB,OAAO,EAAuC,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EACL,OAAO,EAIP,WAAW,EACX,WAAW,GACZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAoC,MAAM,eAAe,CAAC;AA0ChF,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAY5F,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC","sourcesContent":["/**\n * isard: a WebGL2 map engine for large, interactive data layers, labels and 3D Tiles.\n *\n * ```ts\n * import { GeoMap } from 'isard';\n * const map = await GeoMap.create(container, { center: [2.4246, 48.8457], zoom: 13 });\n * const network = map.addNetwork({ nodes, edges, max: 1800, contour: 300 });\n * map.on('hover', ({ lonLat }) => lonLat && network.setValues(travelTimes(lonLat)));\n * map.addTiles3d({ url: 'https://…/tileset.json' });\n * map.addControl(new NavigationControl());\n * new Marker().setLonLat([2.4246, 48.8457]).setPopup(new Popup({ offset: [0, -34] }).setText('Here')).addTo(map);\n * ```\n */\nexport { OPENFREEMAP_ATTRIBUTION, TERRAIN_TILES_ATTRIBUTION } from './basemaps.ts';\nexport {\n AttributionControl,\n type AttributionOptions,\n type Control,\n type ControlPosition,\n NavigationControl,\n type NavigationOptions,\n} from './controls.ts';\nexport {\n type Crs,\n type CrsLike,\n getCrs,\n lambertConformalConic,\n registerCrs,\n reproject,\n transverseMercator,\n} from './crs.ts';\nexport type { DecoderUrls } from './decoders.ts';\nexport type { ExtrusionOptions, ExtrusionStyle, PolygonArrays, TileKey } from './extrusions.ts';\nexport { ExtrusionLayer } from './extrusions.ts';\nexport type {\n CircleOptions,\n CircleStyle,\n Feature,\n FeatureCollection,\n FeatureData,\n FeatureLayerStyle,\n FillOptions,\n FillStyle,\n Geometry,\n LineOptions,\n LineStyle,\n Placement,\n Position,\n Properties,\n Ramp,\n Size,\n Stops,\n Styled,\n} from './features.ts';\nexport { CircleLayer, FeatureLayer, FillLayer, interpolate, LineLayer, parseColor } from './features.ts';\nexport {\n BATIMENTS_3D_URL,\n type BdTopoBuilding,\n batiments3d,\n bdtopoBuildings,\n geoplateformeWfs,\n geoplateformeWms,\n geoplateformeWmts,\n IGN_ATTRIBUTION,\n IGN_PRESETS,\n type IgnPreset,\n} from './geoplateforme.ts';\nexport type { TextPart } from './glyphs.ts';\nexport { DEFAULT_FONT, GLYPHS_URL } from './glyphs.ts';\nexport { parseGpx } from './gpx.ts';\nexport type { TileGrid, TileMatrix } from './grid.ts';\nexport type { ImageOptions, Pixels, SpriteIcon } from './icons.ts';\nexport { parseKml } from './kml.ts';\nexport type {\n CustomFrame,\n CustomLayerInterface,\n GroundOptions,\n GroundTexture,\n ModelInstance,\n ModelOptions,\n} from './layers.ts';\nexport {\n CustomLayer,\n GroundLayer,\n Layer,\n ModelLayer,\n NetworkLayer,\n RasterLayer,\n Tiles3dLayer,\n} from './layers.ts';\nexport { GeoMap, type LayerSpec } from './map.ts';\nexport {\n type Anchor,\n Marker,\n type MarkerEvent,\n type MarkerEvents,\n type MarkerOptions,\n Panel,\n type PanelOptions,\n Popup,\n type PopupEvents,\n type PopupOptions,\n} from './overlay.ts';\nexport { type Panorama, type PanoramaOptions, Panoramas } from './panoramas.ts';\nexport {\n PMTiles,\n type PmtilesEntry,\n type PmtilesHeader,\n type PmtilesTileType,\n tileIdToZxy,\n zxyToTileId,\n} from './pmtiles.ts';\nexport type { ClassStyle, PointCloudOptions, PointCloudStyle, PointColor } from './pointclouds.ts';\nexport { CLASSIFICATIONS, ELEVATION_RAMP, PointCloudLayer } from './pointclouds.ts';\nexport { setRequestHeaders } from './requests.ts';\nexport type { Overlap, SymbolOptions, SymbolStyle } from './symbols.ts';\nexport { SymbolLayer } from './symbols.ts';\nexport { parseTopoJson, type TopoGeometry, type Topology } from './topojson.ts';\nexport type {\n AnimationOptions,\n AtmosphereOptions,\n Basemap,\n BasemapName,\n BodyOptions,\n CelestialBody,\n FeatureHit,\n FirstPersonView,\n FlyToOptions,\n GeoMapOptions,\n LoadingMode,\n LonLat,\n MapEvents,\n MapHoverFeatureEvent,\n MapPointerEvent,\n NetworkOptions,\n NetworkStyle,\n Point,\n Projection,\n RasterGrid,\n RasterOptions,\n RasterStyle,\n SwipeOptions,\n TerrainEncoding,\n TerrainModel,\n TerrainOptions,\n Tiles3dOptions,\n Tiles3dStyle,\n ViewshedOptions,\n} from './types.ts';\nexport type {\n CandidateIcon,\n CandidateOverlap,\n Json,\n LabelCandidate,\n RasterSource,\n Style,\n StyleLayer,\n} from './vectorstyle.ts';\nexport type { PmtilesOptions, VectorTilesOptions } from './vectortiles.ts';\nexport { basicStyle, OPENFREEMAP_STYLES, PLAN_STYLES, VectorTiles } from './vectortiles.ts';\nexport type {\n Camera,\n NetworkStats,\n PickHit,\n PickResult,\n PointCloudInfo,\n PointCloudPoint,\n PointCloudStats,\n RasterLayerStats,\n Tiles3dStats,\n} from './wasm/isard.js';\nexport { parseWmtsGrid, wmtsGrid } from './wmts.ts';\n"]}
|
package/dist/interaction.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ export declare class Interaction {
|
|
|
30
30
|
/** The canvas's place on the page, read once: reading it on every pointer move would force a layout each time.
|
|
31
31
|
* Read again after a resize, a scroll, and when a pointer comes in or goes down */
|
|
32
32
|
private rect;
|
|
33
|
+
/** A double click zooms in (Shift: out); off while the page takes double clicks (ending a drawing) */
|
|
34
|
+
doubleClickZoom: boolean;
|
|
33
35
|
constructor(map: GeoMap, options?: {
|
|
34
36
|
keyboard?: boolean;
|
|
35
37
|
});
|
package/dist/interaction.js
CHANGED
|
@@ -85,6 +85,8 @@ export class Interaction {
|
|
|
85
85
|
/** The canvas's place on the page, read once: reading it on every pointer move would force a layout each time.
|
|
86
86
|
* Read again after a resize, a scroll, and when a pointer comes in or goes down */
|
|
87
87
|
rect;
|
|
88
|
+
/** A double click zooms in (Shift: out); off while the page takes double clicks (ending a drawing) */
|
|
89
|
+
doubleClickZoom = true;
|
|
88
90
|
constructor(map, options = {}) {
|
|
89
91
|
this.map = map;
|
|
90
92
|
const canvas = map.canvas;
|
|
@@ -120,7 +122,10 @@ export class Interaction {
|
|
|
120
122
|
const wheel = (e) => this.onWheel(e);
|
|
121
123
|
container.addEventListener('wheel', wheel, { passive: false });
|
|
122
124
|
this.cleanup.push(() => container.removeEventListener('wheel', wheel));
|
|
123
|
-
listen('dblclick', (e) =>
|
|
125
|
+
listen('dblclick', (e) => {
|
|
126
|
+
if (this.doubleClickZoom && !this.map.firstPerson)
|
|
127
|
+
this.zoomBy(e.shiftKey ? -1 : 1, this.local(e));
|
|
128
|
+
});
|
|
124
129
|
listen('contextmenu', (e) => e.preventDefault());
|
|
125
130
|
if (options.keyboard ?? true) {
|
|
126
131
|
// On the container: the keys work with the focus on a marker or a control too
|
|
@@ -163,6 +168,14 @@ export class Interaction {
|
|
|
163
168
|
const [dx, dy] = [point[0] - p.point[0], point[1] - p.point[1]];
|
|
164
169
|
if (Math.hypot(point[0] - p.start[0], point[1] - p.start[1]) > CLICK_TOLERANCE)
|
|
165
170
|
this.moved = true;
|
|
171
|
+
const eye = this.map.firstPerson;
|
|
172
|
+
if (eye) {
|
|
173
|
+
// At street level the drag turns the eye, the scene following the pointer as if grabbed
|
|
174
|
+
const degrees = eye.fov / Math.max(1, this.map.canvas.clientHeight);
|
|
175
|
+
this.map.setFirstPerson({ ...eye, bearing: eye.bearing - dx * degrees, pitch: eye.pitch + dy * degrees });
|
|
176
|
+
p.point = point;
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
166
179
|
const engine = this.map.engine;
|
|
167
180
|
const other = [...this.pointers.values()].find((q) => q !== p);
|
|
168
181
|
if (this.pointers.size === 2 && other) {
|
|
@@ -197,7 +210,7 @@ export class Interaction {
|
|
|
197
210
|
this.map.emit('click', { point: p.point, lonLat: this.map.unproject(p.point) });
|
|
198
211
|
return;
|
|
199
212
|
}
|
|
200
|
-
if (!p.rotate && this.pointers.size === 0)
|
|
213
|
+
if (!p.rotate && this.pointers.size === 0 && !this.map.firstPerson)
|
|
201
214
|
this.inertia(e.timeStamp, p.point);
|
|
202
215
|
}
|
|
203
216
|
/** Keeps panning at the release speed (last 50 ms), decaying exponentially */
|
|
@@ -229,6 +242,12 @@ export class Interaction {
|
|
|
229
242
|
e.preventDefault();
|
|
230
243
|
// Lines (Firefox mouse wheels) are about 33 px
|
|
231
244
|
const pixels = e.deltaMode === 1 ? e.deltaY * 33 : e.deltaY;
|
|
245
|
+
const eye = this.map.firstPerson;
|
|
246
|
+
if (eye) {
|
|
247
|
+
// At street level: a narrower or wider field of view
|
|
248
|
+
this.map.setFirstPerson({ ...eye, fov: eye.fov * Math.exp(pixels * 0.001) });
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
232
251
|
this.zoomBy(Math.max(-1, Math.min(1, -pixels * WHEEL_RATE)), this.local(e), e.deltaMode === 0 && Math.abs(pixels) < 40);
|
|
233
252
|
}
|
|
234
253
|
onKey(e) {
|
|
@@ -238,6 +257,14 @@ export class Interaction {
|
|
|
238
257
|
if (!action)
|
|
239
258
|
return;
|
|
240
259
|
e.preventDefault();
|
|
260
|
+
const eye = this.map.firstPerson;
|
|
261
|
+
if (eye) {
|
|
262
|
+
// At street level the arrows turn the eye
|
|
263
|
+
const turn = { ArrowLeft: [-10, 0], ArrowRight: [10, 0], ArrowUp: [0, 10], ArrowDown: [0, -10] }[e.key];
|
|
264
|
+
if (turn)
|
|
265
|
+
this.map.setFirstPerson({ ...eye, bearing: eye.bearing + (turn[0] ?? 0), pitch: eye.pitch + (turn[1] ?? 0) });
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
241
268
|
this.wheel.pending = 0;
|
|
242
269
|
const reduced = typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
243
270
|
this.map.easeTo(keyCamera(action, this.map.getCamera()), reduced ? 0 : KEY_DURATION);
|
package/dist/interaction.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interaction.js","sourceRoot":"","sources":["../src/interaction.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAK1D,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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AC;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;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 */\nimport { latitude, mercatorX, mercatorY } from './geo.ts';\nimport type { GeoMap } from './map.ts';\nimport type { Point } from './types.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\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) => this.zoomBy(e.shiftKey ? -1 : 1, this.local(e)));\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 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.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 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 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/interaction.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAK1D,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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,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 */\nimport { latitude, mercatorX, mercatorY } from './geo.ts';\nimport type { GeoMap } from './map.ts';\nimport type { Point } from './types.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"]}
|
package/dist/isard_bg.wasm
CHANGED
|
Binary file
|
package/dist/isard_core_bg.wasm
CHANGED
|
Binary file
|
package/dist/layers.d.ts
CHANGED
|
@@ -5,6 +5,9 @@ export declare abstract class Layer {
|
|
|
5
5
|
#private;
|
|
6
6
|
/** Id of the layer in the engine */
|
|
7
7
|
get id(): number;
|
|
8
|
+
/** Resolves once the map has drawn the layer, what it shows in view loaded (the map idle after it was added; a
|
|
9
|
+
* layer waiting for the engine with 3D Tiles, once that one has drawn it) */
|
|
10
|
+
get ready(): Promise<void>;
|
|
8
11
|
remove(): void;
|
|
9
12
|
/** Moves the layer under `other`, or on top of every layer (above the labels of a vector basemap too) */
|
|
10
13
|
moveBefore(other: Layer | undefined): void;
|
|
@@ -14,8 +17,6 @@ export declare class RasterLayer extends Layer {
|
|
|
14
17
|
private readonly options;
|
|
15
18
|
/** Changes the opacity or saturation, the other kept */
|
|
16
19
|
setStyle(style: Partial<RasterStyle>): void;
|
|
17
|
-
/** @deprecated Positional form (saturation back to 1 when not given): `setStyle({ opacity, saturation })` */
|
|
18
|
-
setStyle(opacity: number, saturation?: number): void;
|
|
19
20
|
}
|
|
20
21
|
/** Line network colored by a value per node (travel time, water depth…) */
|
|
21
22
|
export declare class NetworkLayer extends Layer {
|
|
@@ -42,11 +43,13 @@ export declare class NetworkLayer extends Layer {
|
|
|
42
43
|
/** Textured meshes in 3D Tiles */
|
|
43
44
|
export declare class Tiles3dLayer extends Layer {
|
|
44
45
|
private readonly url;
|
|
46
|
+
private readonly geoid;
|
|
45
47
|
private style;
|
|
46
48
|
setStyle(style: Partial<Tiles3dStyle>): void;
|
|
47
49
|
/** Loading counters; undefined once the layer is removed, and while the engine with 3D Tiles loads (see
|
|
48
50
|
* `GeoMapOptions.tiles3d`) */
|
|
49
51
|
stats(): Tiles3dStats | undefined;
|
|
52
|
+
private applyStyle;
|
|
50
53
|
}
|
|
51
54
|
/** A texture of a ground layer (see `GroundLayer`) */
|
|
52
55
|
export interface GroundTexture {
|