@zwishing/emap 0.3.2 → 0.3.3
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 +23 -1
- package/dist/emap.js +2 -2
- package/dist/emap.mjs +1 -1
- package/dist/map/map.d.ts +17 -3
- package/dist/map/types.d.ts +11 -0
- package/dist/renderer/render-scheduler.d.ts +32 -0
- package/package.json +1 -1
package/dist/map/map.d.ts
CHANGED
|
@@ -33,13 +33,14 @@ import { Control, ControlPosition } from '../ui/control';
|
|
|
33
33
|
import type { LayerSpecification } from './layer';
|
|
34
34
|
import type { MapshaperLayer } from '../types/mapshaper-types';
|
|
35
35
|
export * from './types';
|
|
36
|
-
import { type ExpressionEvaluationPolicy, type MapOptions, type QueryFeaturesOptions, type QueriedFeature, type FeatureRef, type HighlightFeatureRef, type ExportSnapshotOptions, type LoadSnapshotOptions, type HighlightStyle, type EditVertexState, type EditDrawState } from './types';
|
|
36
|
+
import { type ExpressionEvaluationPolicy, type MapOptions, type QueryFeaturesOptions, type QueriedFeature, type FeatureRef, type HighlightFeatureRef, type ExportSnapshotOptions, type LoadSnapshotOptions, type HighlightStyle, type EditVertexState, type EditDrawState, type RenderRequest, type RenderAction, type AffineDelta } from './types';
|
|
37
37
|
export declare class Emap extends EventDispatcher {
|
|
38
38
|
private _container;
|
|
39
39
|
private _canvasContainer;
|
|
40
40
|
private _canvas;
|
|
41
41
|
private _painter;
|
|
42
42
|
private _editOverlay;
|
|
43
|
+
private _scheduler;
|
|
43
44
|
private _viewport;
|
|
44
45
|
private _projection;
|
|
45
46
|
private _camera;
|
|
@@ -72,6 +73,11 @@ export declare class Emap extends EventDispatcher {
|
|
|
72
73
|
private _transformFeature;
|
|
73
74
|
private _pendingRender;
|
|
74
75
|
private _rafId;
|
|
76
|
+
private _pendingAction;
|
|
77
|
+
private _pendingNavDelta;
|
|
78
|
+
private _navSnapshotTransform;
|
|
79
|
+
private _wheelSettleTimer;
|
|
80
|
+
private static readonly _WHEEL_SETTLE_MS;
|
|
75
81
|
private _controlContainers;
|
|
76
82
|
private _controls;
|
|
77
83
|
private _highlightManager;
|
|
@@ -176,6 +182,9 @@ export declare class Emap extends EventDispatcher {
|
|
|
176
182
|
setEditDrawState(state: EditDrawState): void;
|
|
177
183
|
clearEditDrawState(): void;
|
|
178
184
|
private _attachEventListeners;
|
|
185
|
+
private _ensureNavSnapshot;
|
|
186
|
+
private _computeNavDelta;
|
|
187
|
+
private _endNavGesture;
|
|
179
188
|
private _createCanvasContainer;
|
|
180
189
|
private _updateSize;
|
|
181
190
|
addSource(id: string, source: TopologySource): void;
|
|
@@ -281,9 +290,14 @@ export declare class Emap extends EventDispatcher {
|
|
|
281
290
|
fitBounds(b: import('../geo/bounds').Bounds, o?: FitBoundsOptions): this;
|
|
282
291
|
/** Cancel any running camera animation (no-op when idle). */
|
|
283
292
|
stop(): this;
|
|
284
|
-
_scheduleRender(): void;
|
|
293
|
+
_scheduleRender(action?: RenderAction, navDelta?: AffineDelta): void;
|
|
285
294
|
private _doRender;
|
|
286
|
-
render(): void;
|
|
295
|
+
render(req?: RenderRequest): void;
|
|
296
|
+
private _renderFull;
|
|
297
|
+
private _renderImpl;
|
|
298
|
+
private _captureRenderSnapshot;
|
|
299
|
+
private _applyFastTransform;
|
|
300
|
+
private _clearFastTransform;
|
|
287
301
|
private _renderLayers;
|
|
288
302
|
private _renderLineLayer;
|
|
289
303
|
private _renderFillLayer;
|
package/dist/map/types.d.ts
CHANGED
|
@@ -4,6 +4,17 @@ import type { DrawOverlayState, DrawOverlaySnapKind } from '../renderer/painter'
|
|
|
4
4
|
export type EditDrawState = DrawOverlayState;
|
|
5
5
|
export type SnapKind = DrawOverlaySnapKind;
|
|
6
6
|
export type ExpressionEvaluationPolicy = 'trusted' | 'disabled';
|
|
7
|
+
export type RenderAction = 'redraw' | 'nav';
|
|
8
|
+
export interface AffineDelta {
|
|
9
|
+
tx: number;
|
|
10
|
+
ty: number;
|
|
11
|
+
sx: number;
|
|
12
|
+
sy: number;
|
|
13
|
+
}
|
|
14
|
+
export interface RenderRequest {
|
|
15
|
+
action?: RenderAction;
|
|
16
|
+
navDelta?: AffineDelta;
|
|
17
|
+
}
|
|
7
18
|
export interface MapOptions {
|
|
8
19
|
container: string | HTMLElement;
|
|
9
20
|
interactive?: boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AffineDelta, RenderRequest } from '../map/types';
|
|
2
|
+
export declare const SLOW_FRAME_MS = 100;
|
|
3
|
+
export declare const FAST_SETTLE_FALLBACK_MS = 2000;
|
|
4
|
+
export interface RenderSnapshot {
|
|
5
|
+
canvasWidth: number;
|
|
6
|
+
canvasHeight: number;
|
|
7
|
+
pixelRatio: number;
|
|
8
|
+
}
|
|
9
|
+
export interface RenderCallbacks {
|
|
10
|
+
fullRedraw: () => void;
|
|
11
|
+
fastNav: (delta: AffineDelta) => void;
|
|
12
|
+
getSnapshot: () => RenderSnapshot;
|
|
13
|
+
}
|
|
14
|
+
export declare class RenderScheduler {
|
|
15
|
+
private _callbacks;
|
|
16
|
+
private _lastFrameMs;
|
|
17
|
+
private _snapshot;
|
|
18
|
+
private _fastActive;
|
|
19
|
+
private _settleRequested;
|
|
20
|
+
private _settleTimer;
|
|
21
|
+
constructor(_callbacks: RenderCallbacks);
|
|
22
|
+
schedule(req?: RenderRequest): void;
|
|
23
|
+
recordFrame(ms: number, snapshot: RenderSnapshot): void;
|
|
24
|
+
notifyInteractionEnd(hasPendingNav?: boolean): void;
|
|
25
|
+
dispose(): void;
|
|
26
|
+
get lastFrameMs(): number;
|
|
27
|
+
get fastActive(): boolean;
|
|
28
|
+
private _fullRedrawNow;
|
|
29
|
+
private _shouldUseFastNav;
|
|
30
|
+
private _markRedrawPending;
|
|
31
|
+
private _cancelSettle;
|
|
32
|
+
}
|