ts-maps 0.2.7 → 0.3.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/LICENSE.md +21 -0
- package/README.md +202 -141
- package/dist/core-map/assets/embedded-icons.d.ts +8 -0
- package/dist/core-map/control/AttributionControl.d.ts +12 -0
- package/dist/core-map/control/Control.d.ts +14 -0
- package/dist/core-map/control/LayersControl.d.ts +38 -0
- package/dist/core-map/control/ScaleControl.d.ts +14 -0
- package/dist/core-map/control/ZoomControl.d.ts +14 -0
- package/dist/core-map/control/index.d.ts +5 -0
- package/dist/core-map/core/Browser.d.ts +24 -0
- package/dist/core-map/core/Class.d.ts +12 -0
- package/dist/core-map/core/Events.d.ts +31 -0
- package/dist/core-map/core/Handler.d.ts +12 -0
- package/dist/core-map/core/Util.d.ts +24 -0
- package/dist/core-map/core/index.d.ts +7 -0
- package/dist/core-map/dom/Animation.d.ts +50 -0
- package/dist/core-map/dom/DomEvent.DoubleTap.d.ts +6 -0
- package/dist/core-map/dom/DomEvent.PointerEvents.d.ts +4 -0
- package/dist/core-map/dom/DomEvent.d.ts +15 -0
- package/dist/core-map/dom/DomUtil.d.ts +22 -0
- package/dist/core-map/dom/Draggable.d.ts +26 -0
- package/dist/core-map/dom/PosAnimation.d.ts +19 -0
- package/dist/core-map/dom/easing.d.ts +41 -0
- package/dist/core-map/dom/index.d.ts +8 -0
- package/dist/core-map/geo/LatLng.d.ts +18 -0
- package/dist/core-map/geo/LatLngBounds.d.ts +27 -0
- package/dist/core-map/geo/TerrainSource.d.ts +35 -0
- package/dist/core-map/geo/crs/CRS.d.ts +23 -0
- package/dist/core-map/geo/crs/EPSG3395.d.ts +7 -0
- package/dist/core-map/geo/crs/EPSG3857.d.ts +10 -0
- package/dist/core-map/geo/crs/EPSG4326.d.ts +7 -0
- package/dist/core-map/geo/crs/EarthCRS.d.ts +7 -0
- package/dist/core-map/geo/crs/SimpleCRS.d.ts +11 -0
- package/dist/core-map/geo/crs/index.d.ts +6 -0
- package/dist/core-map/geo/elevation.d.ts +23 -0
- package/dist/core-map/geo/index.d.ts +13 -0
- package/dist/core-map/geo/index.js +1204 -0
- package/dist/core-map/geo/projection/Projection.Globe.d.ts +30 -0
- package/dist/core-map/geo/projection/Projection.LonLat.d.ts +11 -0
- package/dist/core-map/geo/projection/Projection.Mercator.d.ts +6 -0
- package/dist/core-map/geo/projection/Projection.SphericalMercator.d.ts +6 -0
- package/dist/core-map/geo/projection/index.d.ts +5 -0
- package/dist/core-map/geo/terrainMesh.d.ts +21 -0
- package/dist/core-map/geometry/Bounds.d.ts +23 -0
- package/dist/core-map/geometry/LineUtil.d.ts +13 -0
- package/dist/core-map/geometry/Point.d.ts +35 -0
- package/dist/core-map/geometry/PolyUtil.d.ts +6 -0
- package/dist/core-map/geometry/RTree.d.ts +35 -0
- package/dist/core-map/geometry/Transformation.d.ts +12 -0
- package/dist/core-map/geometry/earcut.d.ts +17 -0
- package/dist/core-map/geometry/index.d.ts +10 -0
- package/dist/core-map/geometry/index.js +1586 -0
- package/dist/core-map/index.d.ts +59 -0
- package/dist/core-map/layer/BlanketOverlay.d.ts +24 -0
- package/dist/core-map/layer/DivOverlay.d.ts +40 -0
- package/dist/core-map/layer/FeatureGroup.d.ts +11 -0
- package/dist/core-map/layer/GeoJSON.d.ts +17 -0
- package/dist/core-map/layer/GeoJSONClusterSource.d.ts +54 -0
- package/dist/core-map/layer/HeatmapLayer.d.ts +40 -0
- package/dist/core-map/layer/ImageOverlay.d.ts +27 -0
- package/dist/core-map/layer/Layer.d.ts +18 -0
- package/dist/core-map/layer/LayerGroup.d.ts +16 -0
- package/dist/core-map/layer/Popup.d.ts +18 -0
- package/dist/core-map/layer/SVGOverlay.d.ts +4 -0
- package/dist/core-map/layer/Tooltip.d.ts +15 -0
- package/dist/core-map/layer/VideoOverlay.d.ts +4 -0
- package/dist/core-map/layer/index.d.ts +18 -0
- package/dist/core-map/layer/marker/DefaultIcon.d.ts +7 -0
- package/dist/core-map/layer/marker/DivIcon.d.ts +5 -0
- package/dist/core-map/layer/marker/Icon.d.ts +10 -0
- package/dist/core-map/layer/marker/Marker.Drag.d.ts +17 -0
- package/dist/core-map/layer/marker/Marker.d.ts +37 -0
- package/dist/core-map/layer/marker/index.d.ts +5 -0
- package/dist/core-map/layer/tile/GridLayer.d.ts +88 -0
- package/dist/core-map/layer/tile/RasterDEMLayer.d.ts +46 -0
- package/dist/core-map/layer/tile/TileLayer.d.ts +22 -0
- package/dist/core-map/layer/tile/VectorTileMapLayer.d.ts +145 -0
- package/dist/core-map/layer/tile/WMSTileLayer.d.ts +12 -0
- package/dist/core-map/layer/tile/index.d.ts +15 -0
- package/dist/core-map/layer/tile/urlTemplate.d.ts +17 -0
- package/dist/core-map/layer/vector/Canvas.d.ts +52 -0
- package/dist/core-map/layer/vector/Circle.d.ts +7 -0
- package/dist/core-map/layer/vector/CircleMarker.d.ts +22 -0
- package/dist/core-map/layer/vector/Path.d.ts +20 -0
- package/dist/core-map/layer/vector/Polygon.d.ts +13 -0
- package/dist/core-map/layer/vector/Polyline.d.ts +30 -0
- package/dist/core-map/layer/vector/Rectangle.d.ts +6 -0
- package/dist/core-map/layer/vector/Renderer.d.ts +12 -0
- package/dist/core-map/layer/vector/Renderer.getRenderer.d.ts +1 -0
- package/dist/core-map/layer/vector/SVG.d.ts +21 -0
- package/dist/core-map/layer/vector/index.d.ts +10 -0
- package/dist/core-map/map/Map.d.ts +353 -0
- package/dist/core-map/map/Style.d.ts +29 -0
- package/dist/core-map/map/handler/BoxZoomHandler.d.ts +23 -0
- package/dist/core-map/map/handler/DoubleClickZoomHandler.d.ts +6 -0
- package/dist/core-map/map/handler/DragHandler.d.ts +27 -0
- package/dist/core-map/map/handler/KeyboardHandler.d.ts +18 -0
- package/dist/core-map/map/handler/PinchZoomHandler.d.ts +20 -0
- package/dist/core-map/map/handler/ScrollWheelZoomHandler.d.ts +12 -0
- package/dist/core-map/map/handler/TapHoldHandler.d.ts +15 -0
- package/dist/core-map/map/handler/TwoFingerPitchHandler.d.ts +21 -0
- package/dist/core-map/map/handler/TwoFingerRotateHandler.d.ts +17 -0
- package/dist/core-map/map/index.d.ts +11 -0
- package/dist/core-map/mvt/VectorTile.d.ts +9 -0
- package/dist/core-map/mvt/VectorTileFeature.d.ts +59 -0
- package/dist/core-map/mvt/VectorTileLayer.d.ts +13 -0
- package/dist/core-map/proto/Pbf.d.ts +84 -0
- package/dist/core-map/renderer/webgl/GLContext.d.ts +22 -0
- package/dist/core-map/renderer/webgl/WebGLTileRenderer.d.ts +86 -0
- package/dist/core-map/renderer/webgl/index.d.ts +9 -0
- package/dist/core-map/renderer/webgl/mat4.d.ts +14 -0
- package/dist/core-map/services/index.d.ts +26 -0
- package/dist/core-map/services/index.js +1230 -0
- package/dist/core-map/services/providers/Google.d.ts +16 -0
- package/dist/core-map/services/providers/Mapbox.d.ts +26 -0
- package/dist/core-map/services/providers/Maptiler.d.ts +11 -0
- package/dist/core-map/services/providers/Nominatim.d.ts +11 -0
- package/dist/core-map/services/providers/OSRM.d.ts +20 -0
- package/dist/core-map/services/providers/Photon.d.ts +10 -0
- package/dist/core-map/services/providers/Valhalla.d.ts +20 -0
- package/dist/core-map/services/types.d.ts +84 -0
- package/dist/core-map/storage/TileCache.d.ts +40 -0
- package/dist/core-map/storage/cachedFetch.d.ts +13 -0
- package/dist/core-map/storage/defaultCache.d.ts +3 -0
- package/dist/core-map/storage/index.d.ts +13 -0
- package/dist/core-map/storage/index.js +283 -0
- package/dist/core-map/storage/offlineRegion.d.ts +26 -0
- package/dist/core-map/style-spec/diff.d.ts +17 -0
- package/dist/core-map/style-spec/expressions/Color.d.ts +16 -0
- package/dist/core-map/style-spec/expressions/compile.d.ts +4 -0
- package/dist/core-map/style-spec/expressions/errors.d.ts +8 -0
- package/dist/core-map/style-spec/expressions/index.d.ts +16 -0
- package/dist/core-map/style-spec/expressions/legacyFilter.d.ts +6 -0
- package/dist/core-map/style-spec/expressions/operators/conversion.d.ts +1 -0
- package/dist/core-map/style-spec/expressions/operators/interpolate.d.ts +14 -0
- package/dist/core-map/style-spec/expressions/operators/logical.d.ts +1 -0
- package/dist/core-map/style-spec/expressions/operators/lookup.d.ts +1 -0
- package/dist/core-map/style-spec/expressions/operators/math.d.ts +1 -0
- package/dist/core-map/style-spec/expressions/operators/string.d.ts +1 -0
- package/dist/core-map/style-spec/expressions/registry.d.ts +29 -0
- package/dist/core-map/style-spec/expressions/types.d.ts +48 -0
- package/dist/core-map/style-spec/expressions/validate.d.ts +13 -0
- package/dist/core-map/style-spec/index.d.ts +68 -0
- package/dist/core-map/style-spec/index.js +2529 -0
- package/dist/core-map/style-spec/schema.d.ts +381 -0
- package/dist/core-map/style-spec/types.d.ts +375 -0
- package/dist/core-map/style-spec/validate.d.ts +14 -0
- package/dist/core-map/symbols/CollisionIndex.d.ts +21 -0
- package/dist/core-map/symbols/GlyphAtlas.d.ts +38 -0
- package/dist/core-map/symbols/IconAtlas.d.ts +18 -0
- package/dist/core-map/symbols/index.d.ts +6 -0
- package/dist/core-map/symbols/index.js +501 -0
- package/dist/index.d.ts +2 -4
- package/dist/index.js +18414 -1857
- package/package.json +50 -58
- package/src/core-map/ts-maps.css +725 -0
- package/dist/components/base.d.ts +0 -17
- package/dist/components/concerns/interactable.d.ts +0 -1
- package/dist/components/line.d.ts +0 -29
- package/dist/components/marker.d.ts +0 -50
- package/dist/components/region.d.ts +0 -46
- package/dist/components/tooltip.d.ts +0 -22
- package/dist/core/apply-transform.d.ts +0 -7
- package/dist/core/coords-to-point.d.ts +0 -12
- package/dist/core/create-lines.d.ts +0 -2
- package/dist/core/create-markers.d.ts +0 -2
- package/dist/core/create-regions.d.ts +0 -2
- package/dist/core/create-series.d.ts +0 -3
- package/dist/core/get-inset-for-point.d.ts +0 -13
- package/dist/core/get-marker-position.d.ts +0 -6
- package/dist/core/index.d.ts +0 -1
- package/dist/core/reposition-labels.d.ts +0 -2
- package/dist/core/reposition-lines.d.ts +0 -2
- package/dist/core/reposition-markers.d.ts +0 -2
- package/dist/core/resize.d.ts +0 -3
- package/dist/core/set-focus.d.ts +0 -2
- package/dist/core/set-scale.d.ts +0 -2
- package/dist/core/setup-container-events.d.ts +0 -2
- package/dist/core/setup-container-touch-events.d.ts +0 -2
- package/dist/core/setup-element-events.d.ts +0 -2
- package/dist/core/setup-zoom-buttons.d.ts +0 -2
- package/dist/core/update-size.d.ts +0 -2
- package/dist/data-visualization.d.ts +0 -17
- package/dist/defaults/events.d.ts +0 -1
- package/dist/defaults/options.d.ts +0 -1
- package/dist/event-handler.d.ts +0 -1
- package/dist/legend.d.ts +0 -17
- package/dist/map.d.ts +0 -81
- package/dist/maps/brasil.d.ts +0 -2
- package/dist/maps/brasil.js +0 -7
- package/dist/maps/canada.d.ts +0 -2
- package/dist/maps/canada.js +0 -7
- package/dist/maps/iraq.d.ts +0 -2
- package/dist/maps/iraq.js +0 -84
- package/dist/maps/italy.d.ts +0 -2
- package/dist/maps/italy.js +0 -7
- package/dist/maps/russia.d.ts +0 -2
- package/dist/maps/russia.js +0 -366
- package/dist/maps/spain.d.ts +0 -2
- package/dist/maps/spain.js +0 -7
- package/dist/maps/us-aea-en.d.ts +0 -2
- package/dist/maps/us-aea-en.js +0 -7
- package/dist/maps/us-lcc-en.d.ts +0 -2
- package/dist/maps/us-lcc-en.js +0 -7
- package/dist/maps/us-merc-en.d.ts +0 -2
- package/dist/maps/us-merc-en.js +0 -7
- package/dist/maps/us-mill-en.d.ts +0 -2
- package/dist/maps/us-mill-en.js +0 -7
- package/dist/maps/world-merc.d.ts +0 -2
- package/dist/maps/world-merc.js +0 -7
- package/dist/maps/world.d.ts +0 -2
- package/dist/maps/world.js +0 -7
- package/dist/projection.d.ts +0 -1
- package/dist/scales/ordinal-scale.d.ts +0 -12
- package/dist/series.d.ts +0 -14
- package/dist/svg/base-element.d.ts +0 -19
- package/dist/svg/canvas-element.d.ts +0 -21
- package/dist/svg/image-element.d.ts +0 -12
- package/dist/svg/shape-element.d.ts +0 -19
- package/dist/svg/text-element.d.ts +0 -7
- package/dist/types.d.ts +0 -418
- package/dist/util/deep-merge.d.ts +0 -2
- package/dist/util/index.d.ts +0 -18
- package/dist/utils.d.ts +0 -87
- package/dist/vector-map.d.ts +0 -5
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Returns the unique ID of an object, assigning it one if it doesn't have it.
|
|
2
|
+
export declare function stamp(obj: any): number;
|
|
3
|
+
export declare function setLastId(id: number): void;
|
|
4
|
+
// Returns a function which executes `fn` no more than one time per given amount of `time`.
|
|
5
|
+
export declare function throttle< T extends (...args: any[]) => any >(fn: T, time: number, context?: any): (...args: Parameters < T>) => void;
|
|
6
|
+
// Returns the number `num` modulo `range` so it lies within `range[0]` and `range[1]`.
|
|
7
|
+
export declare function wrapNum(x: number, range: [number, number] | number[], includeMax?: boolean): number;
|
|
8
|
+
// Always returns false.
|
|
9
|
+
export declare function falseFn(..._args: any[]): false;
|
|
10
|
+
// Returns the number `num` rounded with specified `precision` (default 6 decimal places).
|
|
11
|
+
export declare function formatNum(num: number, precision?: number | false): number;
|
|
12
|
+
// Trims and splits the string on whitespace and returns the array of parts.
|
|
13
|
+
export declare function splitWords(str: string): string[];
|
|
14
|
+
// Merges the given properties to the `options` of the `obj`, returning the resulting options.
|
|
15
|
+
export declare function setOptions< T extends { options?: Record<string, any> } >(obj: T, options?: Record<string, any>): Record<string, any>;
|
|
16
|
+
// Simple templating facility: `'Hello {a}, {b}'` + `{a: 'foo', b: 'bar'}` -> `'Hello foo, bar'`.
|
|
17
|
+
export declare function template(str: string, data: Record<string, any>): string;
|
|
18
|
+
// No-op function.
|
|
19
|
+
export declare function noop(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Various utility functions, used internally.
|
|
22
|
+
* @defaultValue 0
|
|
23
|
+
*/
|
|
24
|
+
export declare let lastId: number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as Util from './Util';
|
|
2
|
+
export type { EventHandler, EventListener } from './Events';
|
|
3
|
+
export { default as Browser } from './Browser';
|
|
4
|
+
export { Class } from './Class';
|
|
5
|
+
export { Evented } from './Events';
|
|
6
|
+
export { Handler } from './Handler';
|
|
7
|
+
export { Util };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Evented } from '../core/Events';
|
|
2
|
+
import type { EasingFunction } from './easing';
|
|
3
|
+
export type { EasingFunction } from './easing';
|
|
4
|
+
export declare interface AnimationFrame {
|
|
5
|
+
progress: number
|
|
6
|
+
t: number
|
|
7
|
+
dt: number
|
|
8
|
+
}
|
|
9
|
+
export declare interface AnimationOptions {
|
|
10
|
+
duration: number
|
|
11
|
+
easing?: EasingFunction
|
|
12
|
+
onStart?: () => void
|
|
13
|
+
onFrame: (frame: AnimationFrame) => void
|
|
14
|
+
onEnd?: (completed: boolean) => void
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Unified animation engine for the camera (center / zoom / bearing / pitch /
|
|
18
|
+
* padding). Single-timeline, easing-driven. The caller is responsible for
|
|
19
|
+
* interpolating the actual properties inside `onFrame` — `Animation` only
|
|
20
|
+
* provides the `t` value. That keeps it composable: multi-axis gestures can
|
|
21
|
+
* drive bearing/pitch/zoom in concert by constructing the right `onFrame`
|
|
22
|
+
* closure without the engine needing to know about maps.
|
|
23
|
+
*
|
|
24
|
+
* Only one `run()` can be active at a time. Calling `run()` on a running
|
|
25
|
+
* animation cancels the previous one (fires its `onEnd(false)`) before
|
|
26
|
+
* starting fresh.
|
|
27
|
+
*
|
|
28
|
+
* Events fired (in addition to the callback hooks):
|
|
29
|
+
* `start` — before the first `onFrame`
|
|
30
|
+
* `frame` — every tick, with `{ progress, t, dt }`
|
|
31
|
+
* `end` — on completion or cancellation, with `{ completed }`
|
|
32
|
+
*/
|
|
33
|
+
export declare class Animation extends Evented {
|
|
34
|
+
_opts?: AnimationOptions;
|
|
35
|
+
_easing: EasingFunction;
|
|
36
|
+
_startTime: number;
|
|
37
|
+
_lastTime: number;
|
|
38
|
+
_duration: number;
|
|
39
|
+
_animId?: number;
|
|
40
|
+
_running: boolean;
|
|
41
|
+
_pendingStart: boolean;
|
|
42
|
+
constructor();
|
|
43
|
+
run(opts: AnimationOptions): void;
|
|
44
|
+
cancel(): void;
|
|
45
|
+
stop(): void;
|
|
46
|
+
isRunning(): boolean;
|
|
47
|
+
_tick(timestamp: number): void;
|
|
48
|
+
_emitFrame(progress: number, t: number, dt: number): void;
|
|
49
|
+
_finish(completed: boolean): void;
|
|
50
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function addDoubleTapListener(obj: any, handler: EventListener): DoubleTapHandlers;
|
|
2
|
+
export declare function removeDoubleTapListener(obj: any, handlers: DoubleTapHandlers): void;
|
|
3
|
+
export declare interface DoubleTapHandlers {
|
|
4
|
+
dblclick: EventListener
|
|
5
|
+
simDblclick: (ev: Event) => void
|
|
6
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Point } from '../geometry/Point';
|
|
2
|
+
import * as PointerEvents from './DomEvent.PointerEvents';
|
|
3
|
+
export declare function on(this: any, obj: any, types: any, fn?: any, context?: any): any;
|
|
4
|
+
export declare function off(this: any, obj: any, types?: any, fn?: any, context?: any): any;
|
|
5
|
+
export declare function stopPropagation(this: any, e: any): any;
|
|
6
|
+
export declare function disableScrollPropagation(this: any, el: any): any;
|
|
7
|
+
export declare function disableClickPropagation(this: any, el: any): any;
|
|
8
|
+
export declare function preventDefault(this: any, e: any): any;
|
|
9
|
+
export declare function stop(this: any, e: any): any;
|
|
10
|
+
export declare function getPropagationPath(ev: any): any[];
|
|
11
|
+
export declare function getPointerPosition(e: any, container?: HTMLElement): Point;
|
|
12
|
+
export declare function getWheelPxFactor(): number;
|
|
13
|
+
export declare function getWheelDelta(e: any): number;
|
|
14
|
+
export declare function isExternalTarget(el: Element, e: any): boolean;
|
|
15
|
+
export { PointerEvents };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Point } from '../geometry/Point';
|
|
2
|
+
export declare function get(id: string | HTMLElement): HTMLElement | null;
|
|
3
|
+
export declare function create< K extends keyof HTMLElementTagNameMap >(tagName: K, className?: string, container?: HTMLElement | null): HTMLElementTagNameMap[K];
|
|
4
|
+
export declare function create(tagName: string, className?: string, container?: HTMLElement | null): HTMLElement;
|
|
5
|
+
export declare function toFront(el: Element): void;
|
|
6
|
+
export declare function toBack(el: Element): void;
|
|
7
|
+
export declare function setTransform(el: HTMLElement, offset?: Point | null, scale?: number, rotation?: number, pitch?: number): void;
|
|
8
|
+
export declare function setPosition(el: HTMLElement, point: Point, rotation?: number, pitch?: number): void;
|
|
9
|
+
export declare function getPosition(el: HTMLElement): Point;
|
|
10
|
+
export declare function disableTextSelection(): void;
|
|
11
|
+
export declare function enableTextSelection(): void;
|
|
12
|
+
export declare function disableImageDrag(): void;
|
|
13
|
+
export declare function enableImageDrag(): void;
|
|
14
|
+
export declare function preventOutline(element: HTMLElement): void;
|
|
15
|
+
export declare function restoreOutline(): void;
|
|
16
|
+
export declare function getSizedParentNode(element: HTMLElement): HTMLElement;
|
|
17
|
+
export declare function getScale(element: HTMLElement): ScaleInfo;
|
|
18
|
+
export declare interface ScaleInfo {
|
|
19
|
+
x: number
|
|
20
|
+
y: number
|
|
21
|
+
boundingClientRect: DOMRect
|
|
22
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Evented } from '../core/Events';
|
|
2
|
+
import { Point } from '../geometry/Point';
|
|
3
|
+
import * as DomUtil from './DomUtil';
|
|
4
|
+
export declare class Draggable extends Evented {
|
|
5
|
+
static _dragging: Draggable | false;
|
|
6
|
+
_element: HTMLElement;
|
|
7
|
+
_dragStartTarget: HTMLElement;
|
|
8
|
+
_preventOutline?: boolean;
|
|
9
|
+
_enabled?: boolean;
|
|
10
|
+
_moved?: boolean;
|
|
11
|
+
_moving?: boolean;
|
|
12
|
+
_startPoint?: Point;
|
|
13
|
+
_startPos?: Point;
|
|
14
|
+
_newPos?: Point;
|
|
15
|
+
_lastEvent?: PointerEvent;
|
|
16
|
+
_lastTarget?: HTMLElement | null;
|
|
17
|
+
_parentScale?: DomUtil.ScaleInfo;
|
|
18
|
+
initialize(element: HTMLElement, dragStartTarget?: HTMLElement, preventOutline?: boolean, options?: any): void;
|
|
19
|
+
enable(): this;
|
|
20
|
+
disable(): this;
|
|
21
|
+
_onDown(e: PointerEvent): void;
|
|
22
|
+
_onMove(e: PointerEvent): void;
|
|
23
|
+
_updatePosition(): void;
|
|
24
|
+
_onUp(): void;
|
|
25
|
+
finishDrag(noInertia?: boolean): void;
|
|
26
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Evented } from '../core/Events';
|
|
2
|
+
import type { Point } from '../geometry/Point';
|
|
3
|
+
export declare class PosAnimation extends Evented {
|
|
4
|
+
_el?: HTMLElement;
|
|
5
|
+
_inProgress?: boolean;
|
|
6
|
+
_duration?: number;
|
|
7
|
+
_easeOutPower?: number;
|
|
8
|
+
_startPos?: Point;
|
|
9
|
+
_offset?: Point;
|
|
10
|
+
_startTime?: number;
|
|
11
|
+
_animId?: number;
|
|
12
|
+
run(el: HTMLElement, newPos: Point, duration?: number, easeLinearity?: number): void;
|
|
13
|
+
stop(): void;
|
|
14
|
+
_animate(): void;
|
|
15
|
+
_step(round?: boolean): void;
|
|
16
|
+
_runFrame(progress: number, round?: boolean): void;
|
|
17
|
+
_complete(): void;
|
|
18
|
+
_easeOut(t: number): number;
|
|
19
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare function linear(t: number): number;
|
|
2
|
+
export declare function easeInQuad(t: number): number;
|
|
3
|
+
export declare function easeOutQuad(t: number): number;
|
|
4
|
+
export declare function easeInOutQuad(t: number): number;
|
|
5
|
+
export declare function easeInCubic(t: number): number;
|
|
6
|
+
export declare function easeOutCubic(t: number): number;
|
|
7
|
+
export declare function easeInOutCubic(t: number): number;
|
|
8
|
+
export declare function easeInQuart(t: number): number;
|
|
9
|
+
export declare function easeOutQuart(t: number): number;
|
|
10
|
+
export declare function easeInOutQuart(t: number): number;
|
|
11
|
+
/**
|
|
12
|
+
* `easeOutBack` overshoots slightly past 1 before settling — useful for tiny
|
|
13
|
+
* button-like pops. Do **not** use this as a camera-easing default because
|
|
14
|
+
* the overshoot translates into a brief zoom past the target, which looks
|
|
15
|
+
* glitchy on map moves.
|
|
16
|
+
*/
|
|
17
|
+
export declare function easeOutBack(t: number): number;
|
|
18
|
+
/**
|
|
19
|
+
* Returns an easing function that evaluates a cubic Bezier curve with the
|
|
20
|
+
* given control points at `t`. The endpoints are fixed at `(0, 0)` and
|
|
21
|
+
* `(1, 1)`; `(x1, y1)` and `(x2, y2)` are the two inner control points.
|
|
22
|
+
*
|
|
23
|
+
* This is the same parameterization as CSS `cubic-bezier(x1, y1, x2, y2)`,
|
|
24
|
+
* so `cubicBezier(0.25, 0.1, 0.25, 1)` reproduces the CSS `ease` curve.
|
|
25
|
+
*
|
|
26
|
+
* Newton-Raphson is used to find the Bezier parameter `s` that matches the
|
|
27
|
+
* requested `x = t`. We cap iteration to 10 with an epsilon of 1e-5, which
|
|
28
|
+
* is plenty for frame-rate-driven animation.
|
|
29
|
+
*/
|
|
30
|
+
export declare function cubicBezier(x1: number, y1: number, x2: number, y2: number): EasingFunction;
|
|
31
|
+
/**
|
|
32
|
+
* Zero-dependency easing functions. Every function takes `t` in `[0, 1]` and
|
|
33
|
+
* returns a value in `[0, 1]` (the `easeOutBack` variant can temporarily
|
|
34
|
+
* overshoot past `1`, by design — it's the "spring-tap" feel used in button
|
|
35
|
+
* micro-animations, not the default for camera moves).
|
|
36
|
+
*
|
|
37
|
+
* The default camera easing is `easeInOutCubic`, which matches what most
|
|
38
|
+
* slippy-map libraries (Leaflet, Mapbox GL JS's `easeTo`) feel like out of
|
|
39
|
+
* the box.
|
|
40
|
+
*/
|
|
41
|
+
export type EasingFunction = (_t: number) => number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as DomEvent from './DomEvent';
|
|
2
|
+
import * as DomUtil from './DomUtil';
|
|
3
|
+
export type { AnimationFrame, AnimationOptions, EasingFunction } from './Animation';
|
|
4
|
+
export { PosAnimation } from './PosAnimation';
|
|
5
|
+
export { Animation } from './Animation';
|
|
6
|
+
export * as easing from './easing';
|
|
7
|
+
export { DomEvent, DomUtil };
|
|
8
|
+
export { Draggable } from './Draggable';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LatLngBounds } from './LatLngBounds';
|
|
2
|
+
export declare function toLatLng(a: LatLngLike | null | undefined, b?: number, c?: number): LatLng;
|
|
3
|
+
export type LatLngTuple = [number, number] | [number, number, number];
|
|
4
|
+
export type LatLngLike = LatLng | LatLngTuple | { lat: number, lng?: number, lon?: number, alt?: number } | number;
|
|
5
|
+
// Represents a geographical point (latitude, longitude, optional altitude).
|
|
6
|
+
export declare class LatLng {
|
|
7
|
+
lat: number;
|
|
8
|
+
lng: number;
|
|
9
|
+
alt?: number;
|
|
10
|
+
constructor(lat: LatLngLike | number, lng?: number, alt?: number);
|
|
11
|
+
static validate(lat: any, lng?: any, _alt?: any): boolean;
|
|
12
|
+
equals(obj: LatLngLike, maxMargin?: number): boolean;
|
|
13
|
+
toString(precision?: number): string;
|
|
14
|
+
distanceTo(other: LatLngLike): number;
|
|
15
|
+
wrap(): LatLng;
|
|
16
|
+
toBounds(sizeInMeters: number): LatLngBounds;
|
|
17
|
+
clone(): LatLng;
|
|
18
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LatLng } from './LatLng';
|
|
2
|
+
import type { LatLngLike } from './LatLng';
|
|
3
|
+
export declare function toLatLngBounds(a?: any, b?: LatLngLike): LatLngBounds;
|
|
4
|
+
export type LatLngBoundsLike = LatLngBounds | [LatLngLike, LatLngLike] | LatLngLike[];
|
|
5
|
+
// Represents a rectangular geographical area on a map.
|
|
6
|
+
export declare class LatLngBounds {
|
|
7
|
+
_southWest?: LatLng;
|
|
8
|
+
_northEast?: LatLng;
|
|
9
|
+
constructor(corner1?: any, corner2?: LatLngLike);
|
|
10
|
+
extend(obj: any): this;
|
|
11
|
+
pad(bufferRatio: number): LatLngBounds;
|
|
12
|
+
getCenter(): LatLng;
|
|
13
|
+
getSouthWest(): LatLng;
|
|
14
|
+
getNorthEast(): LatLng;
|
|
15
|
+
getNorthWest(): LatLng;
|
|
16
|
+
getSouthEast(): LatLng;
|
|
17
|
+
getWest(): number;
|
|
18
|
+
getSouth(): number;
|
|
19
|
+
getEast(): number;
|
|
20
|
+
getNorth(): number;
|
|
21
|
+
contains(obj: any): boolean;
|
|
22
|
+
intersects(bounds: LatLngBoundsLike): boolean;
|
|
23
|
+
overlaps(bounds: LatLngBoundsLike): boolean;
|
|
24
|
+
toBBoxString(): string;
|
|
25
|
+
equals(bounds: LatLngBoundsLike | null | undefined, maxMargin?: number): boolean;
|
|
26
|
+
isValid(): boolean;
|
|
27
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type DEMEncoding } from './elevation';
|
|
2
|
+
export declare interface TerrainSourceOptions {
|
|
3
|
+
demSize?: number
|
|
4
|
+
encoding?: DEMEncoding
|
|
5
|
+
meshResolution?: number
|
|
6
|
+
exaggeration?: number
|
|
7
|
+
}
|
|
8
|
+
export declare interface TileCoord {
|
|
9
|
+
z: number
|
|
10
|
+
x: number
|
|
11
|
+
y: number
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Stores decoded DEM tiles keyed on `"z/x/y"` and serves elevation
|
|
15
|
+
* queries. Thread-safe with respect to async add/remove — the underlying
|
|
16
|
+
* Map is the only mutable state.
|
|
17
|
+
*/
|
|
18
|
+
export declare class TerrainSource {
|
|
19
|
+
_tiles: Map<string, Float32Array>;
|
|
20
|
+
_opts: Required<TerrainSourceOptions>;
|
|
21
|
+
constructor(opts?: TerrainSourceOptions);
|
|
22
|
+
get demSize(): number;
|
|
23
|
+
get encoding(): DEMEncoding;
|
|
24
|
+
get meshResolution(): number;
|
|
25
|
+
get exaggeration(): number;
|
|
26
|
+
setExaggeration(v: number): void;
|
|
27
|
+
addTilePixels(coord: TileCoord, pixels: Uint8Array | Uint8ClampedArray): void;
|
|
28
|
+
addTileElevation(coord: TileCoord, elevation: Float32Array): void;
|
|
29
|
+
hasTile(coord: TileCoord): boolean;
|
|
30
|
+
getTile(coord: TileCoord): Float32Array | undefined;
|
|
31
|
+
deleteTile(coord: TileCoord): void;
|
|
32
|
+
clear(): void;
|
|
33
|
+
size(): number;
|
|
34
|
+
queryElevation(lng: number, lat: number, preferredZoom: number): number | null;
|
|
35
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Bounds } from '../../geometry/Bounds';
|
|
2
|
+
import { LatLng } from '../LatLng';
|
|
3
|
+
import { LatLngBounds } from '../LatLngBounds';
|
|
4
|
+
import type { Point } from '../../geometry/Point';
|
|
5
|
+
import type { Transformation } from '../../geometry/Transformation';
|
|
6
|
+
export declare class CRS {
|
|
7
|
+
static projection: any;
|
|
8
|
+
static transformation: Transformation | undefined;
|
|
9
|
+
static code?: string;
|
|
10
|
+
static wrapLng?: [number, number];
|
|
11
|
+
static wrapLat?: [number, number];
|
|
12
|
+
static infinite: boolean;
|
|
13
|
+
static latLngToPoint(this: any, latlng: LatLng, zoom: number): Point;
|
|
14
|
+
static pointToLatLng(this: any, point: Point, zoom: number): LatLng;
|
|
15
|
+
static project(this: any, latlng: LatLng): Point;
|
|
16
|
+
static unproject(this: any, point: Point): LatLng;
|
|
17
|
+
static scale(zoom: number): number;
|
|
18
|
+
static zoom(scale: number): number;
|
|
19
|
+
static getProjectedBounds(this: any, zoom: number): Bounds | null;
|
|
20
|
+
static distance(_a: LatLng, _b: LatLng): number;
|
|
21
|
+
static wrapLatLng(this: any, latlng: LatLng): LatLng;
|
|
22
|
+
static wrapLatLngBounds(this: any, bounds: LatLngBounds): LatLngBounds;
|
|
23
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EarthCRS } from './EarthCRS';
|
|
2
|
+
import { Transformation } from '../../geometry/Transformation';
|
|
3
|
+
export declare class EPSG3857 extends EarthCRS {
|
|
4
|
+
static code: string;
|
|
5
|
+
static projection: any;
|
|
6
|
+
static transformation: Transformation;
|
|
7
|
+
}
|
|
8
|
+
export declare class EPSG900913 extends EPSG3857 {
|
|
9
|
+
static code: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CRS } from './CRS';
|
|
2
|
+
import { Transformation } from '../../geometry/Transformation';
|
|
3
|
+
import type { LatLng } from '../LatLng';
|
|
4
|
+
export declare class SimpleCRS extends CRS {
|
|
5
|
+
static projection: any;
|
|
6
|
+
static transformation: Transformation;
|
|
7
|
+
static infinite: boolean;
|
|
8
|
+
static scale(zoom: number): number;
|
|
9
|
+
static zoom(scale: number): number;
|
|
10
|
+
static distance(latlng1: LatLng, latlng2: LatLng): number;
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare function decodeMapboxRGB(r: number, g: number, b: number): number;
|
|
2
|
+
export declare function decodeTerrariumRGB(r: number, g: number, b: number): number;
|
|
3
|
+
export declare function getElevationDecoder(encoding: DEMEncoding): (r: number, g: number, b: number) => number;
|
|
4
|
+
/**
|
|
5
|
+
* Decode an entire RGBA pixel buffer into a flat `Float32Array` of elevation
|
|
6
|
+
* samples in metres. The caller controls the encoding.
|
|
7
|
+
*/
|
|
8
|
+
export declare function decodeElevationGrid(pixels: Uint8Array | Uint8ClampedArray, encoding?: DEMEncoding): Float32Array;
|
|
9
|
+
/**
|
|
10
|
+
* Bilinearly sample a square elevation grid at the fractional pixel
|
|
11
|
+
* coordinate `(u, v)`, where `(0, 0)` is the top-left pixel centre and
|
|
12
|
+
* `(size - 1, size - 1)` is the bottom-right. Out-of-range inputs clamp
|
|
13
|
+
* to the border (no extrapolation).
|
|
14
|
+
*/
|
|
15
|
+
export declare function sampleElevationBilinear(elev: Float32Array, size: number, u: number, v: number): number;
|
|
16
|
+
// Helpers for reading elevation out of RGB-encoded DEM tiles. Shared
|
|
17
|
+
// between the hillshade-producing `RasterDEMLayer` and the 3D terrain
|
|
18
|
+
// pipeline, which samples per-vertex heights to warp a ground mesh.
|
|
19
|
+
//
|
|
20
|
+
// Two encodings are supported out of the box:
|
|
21
|
+
// - 'mapbox' — Mapbox Terrain-RGB / Maxar (elevation = -10000 + (r*65536 + g*256 + b) * 0.1)
|
|
22
|
+
// - 'terrarium' — Mapzen / AWS Terrarium (elevation = (r*256 + g + b/256) - 32768)
|
|
23
|
+
export type DEMEncoding = 'mapbox' | 'terrarium';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as Projection from './projection/index';
|
|
2
|
+
export type { LatLngLike, LatLngTuple } from './LatLng';
|
|
3
|
+
export type { LatLngBoundsLike } from './LatLngBounds';
|
|
4
|
+
export type { DEMEncoding } from './elevation';
|
|
5
|
+
export type { TerrainMesh, TerrainMeshOptions } from './terrainMesh';
|
|
6
|
+
export type { TerrainSourceOptions, TileCoord } from './TerrainSource';
|
|
7
|
+
export { LatLng, toLatLng } from './LatLng';
|
|
8
|
+
export { LatLngBounds, toLatLngBounds } from './LatLngBounds';
|
|
9
|
+
export { decodeElevationGrid, decodeMapboxRGB, decodeTerrariumRGB, getElevationDecoder, sampleElevationBilinear } from './elevation';
|
|
10
|
+
export { buildTerrainMesh } from './terrainMesh';
|
|
11
|
+
export { TerrainSource } from './TerrainSource';
|
|
12
|
+
export { Projection };
|
|
13
|
+
export * from './crs/index';
|