maplibre-gl-lidar 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +395 -0
  3. package/dist/LidarControl-BFJN1DIQ.js +37815 -0
  4. package/dist/LidarControl-BFJN1DIQ.js.map +1 -0
  5. package/dist/LidarControl-CQjIl4U5.cjs +37814 -0
  6. package/dist/LidarControl-CQjIl4U5.cjs.map +1 -0
  7. package/dist/index.cjs +21 -0
  8. package/dist/index.cjs.map +1 -0
  9. package/dist/index.mjs +21 -0
  10. package/dist/index.mjs.map +1 -0
  11. package/dist/laz-perf.wasm +0 -0
  12. package/dist/laz_rs_wasm_bg.wasm +0 -0
  13. package/dist/libs/laz_rs_wasm_bg.wasm +0 -0
  14. package/dist/maplibre-gl-lidar.css +570 -0
  15. package/dist/react.cjs +179 -0
  16. package/dist/react.cjs.map +1 -0
  17. package/dist/react.mjs +179 -0
  18. package/dist/react.mjs.map +1 -0
  19. package/dist/types/index.d.ts +13 -0
  20. package/dist/types/index.d.ts.map +1 -0
  21. package/dist/types/lib/colorizers/ColorScheme.d.ts +60 -0
  22. package/dist/types/lib/colorizers/ColorScheme.d.ts.map +1 -0
  23. package/dist/types/lib/colorizers/index.d.ts +3 -0
  24. package/dist/types/lib/colorizers/index.d.ts.map +1 -0
  25. package/dist/types/lib/colorizers/types.d.ts +17 -0
  26. package/dist/types/lib/colorizers/types.d.ts.map +1 -0
  27. package/dist/types/lib/core/DeckOverlay.d.ts +64 -0
  28. package/dist/types/lib/core/DeckOverlay.d.ts.map +1 -0
  29. package/dist/types/lib/core/LidarControl.d.ts +318 -0
  30. package/dist/types/lib/core/LidarControl.d.ts.map +1 -0
  31. package/dist/types/lib/core/LidarControlReact.d.ts +35 -0
  32. package/dist/types/lib/core/LidarControlReact.d.ts.map +1 -0
  33. package/dist/types/lib/core/ViewportManager.d.ts +105 -0
  34. package/dist/types/lib/core/ViewportManager.d.ts.map +1 -0
  35. package/dist/types/lib/core/types.d.ts +235 -0
  36. package/dist/types/lib/core/types.d.ts.map +1 -0
  37. package/dist/types/lib/gui/DualRangeSlider.d.ts +46 -0
  38. package/dist/types/lib/gui/DualRangeSlider.d.ts.map +1 -0
  39. package/dist/types/lib/gui/FileInput.d.ts +44 -0
  40. package/dist/types/lib/gui/FileInput.d.ts.map +1 -0
  41. package/dist/types/lib/gui/PanelBuilder.d.ts +117 -0
  42. package/dist/types/lib/gui/PanelBuilder.d.ts.map +1 -0
  43. package/dist/types/lib/gui/RangeSlider.d.ts +50 -0
  44. package/dist/types/lib/gui/RangeSlider.d.ts.map +1 -0
  45. package/dist/types/lib/gui/index.d.ts +7 -0
  46. package/dist/types/lib/gui/index.d.ts.map +1 -0
  47. package/dist/types/lib/hooks/index.d.ts +3 -0
  48. package/dist/types/lib/hooks/index.d.ts.map +1 -0
  49. package/dist/types/lib/hooks/useLidarState.d.ts +52 -0
  50. package/dist/types/lib/hooks/useLidarState.d.ts.map +1 -0
  51. package/dist/types/lib/hooks/usePointCloud.d.ts +53 -0
  52. package/dist/types/lib/hooks/usePointCloud.d.ts.map +1 -0
  53. package/dist/types/lib/layers/PointCloudManager.d.ts +136 -0
  54. package/dist/types/lib/layers/PointCloudManager.d.ts.map +1 -0
  55. package/dist/types/lib/layers/index.d.ts +3 -0
  56. package/dist/types/lib/layers/index.d.ts.map +1 -0
  57. package/dist/types/lib/layers/types.d.ts +71 -0
  58. package/dist/types/lib/layers/types.d.ts.map +1 -0
  59. package/dist/types/lib/loaders/CopcStreamingLoader.d.ts +217 -0
  60. package/dist/types/lib/loaders/CopcStreamingLoader.d.ts.map +1 -0
  61. package/dist/types/lib/loaders/PointCloudLoader.d.ts +61 -0
  62. package/dist/types/lib/loaders/PointCloudLoader.d.ts.map +1 -0
  63. package/dist/types/lib/loaders/index.d.ts +5 -0
  64. package/dist/types/lib/loaders/index.d.ts.map +1 -0
  65. package/dist/types/lib/loaders/streaming-types.d.ts +122 -0
  66. package/dist/types/lib/loaders/streaming-types.d.ts.map +1 -0
  67. package/dist/types/lib/loaders/types.d.ts +83 -0
  68. package/dist/types/lib/loaders/types.d.ts.map +1 -0
  69. package/dist/types/lib/utils/helpers.d.ts +91 -0
  70. package/dist/types/lib/utils/helpers.d.ts.map +1 -0
  71. package/dist/types/lib/utils/index.d.ts +2 -0
  72. package/dist/types/lib/utils/index.d.ts.map +1 -0
  73. package/dist/types/react.d.ts +6 -0
  74. package/dist/types/react.d.ts.map +1 -0
  75. package/package.json +118 -0
@@ -0,0 +1,318 @@
1
+ import { IControl, Map as MapLibreMap } from 'maplibre-gl';
2
+ import { LidarControlOptions, LidarState, LidarControlEvent, LidarControlEventHandler, PointCloudInfo, ColorScheme, CopcLoadingMode } from './types';
3
+ import { StreamingLoaderOptions } from '../loaders/streaming-types';
4
+ import { DeckOverlay } from './DeckOverlay';
5
+ /**
6
+ * A MapLibre GL control for visualizing and styling LiDAR point clouds.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const lidarControl = new LidarControl({
11
+ * title: 'LiDAR Viewer',
12
+ * collapsed: true,
13
+ * pointSize: 2,
14
+ * colorScheme: 'elevation',
15
+ * });
16
+ * map.addControl(lidarControl, 'top-right');
17
+ *
18
+ * // Load a point cloud
19
+ * await lidarControl.loadPointCloud('https://example.com/pointcloud.laz');
20
+ * ```
21
+ */
22
+ export declare class LidarControl implements IControl {
23
+ private _map?;
24
+ private _container?;
25
+ private _panel?;
26
+ private _options;
27
+ private _state;
28
+ private _eventHandlers;
29
+ private _deckOverlay?;
30
+ private _pointCloudManager?;
31
+ private _loader;
32
+ private _panelBuilder?;
33
+ private _tooltip?;
34
+ private _streamingLoaders;
35
+ private _viewportManagers;
36
+ /**
37
+ * Creates a new LidarControl instance.
38
+ *
39
+ * @param options - Configuration options for the control
40
+ */
41
+ constructor(options?: Partial<LidarControlOptions>);
42
+ /**
43
+ * Called when the control is added to the map.
44
+ * Implements the IControl interface.
45
+ *
46
+ * @param map - The MapLibre GL map instance
47
+ * @returns The control's container element
48
+ */
49
+ onAdd(map: MapLibreMap): HTMLElement;
50
+ /**
51
+ * Called when the control is removed from the map.
52
+ * Implements the IControl interface.
53
+ */
54
+ onRemove(): void;
55
+ /**
56
+ * Gets the current state of the control.
57
+ *
58
+ * @returns The current LiDAR state
59
+ */
60
+ getState(): LidarState;
61
+ /**
62
+ * Updates the control state.
63
+ *
64
+ * @param newState - Partial state to merge with current state
65
+ */
66
+ setState(newState: Partial<LidarState>): void;
67
+ /**
68
+ * Toggles the collapsed state of the control panel.
69
+ */
70
+ toggle(): void;
71
+ /**
72
+ * Expands the control panel.
73
+ */
74
+ expand(): void;
75
+ /**
76
+ * Collapses the control panel.
77
+ */
78
+ collapse(): void;
79
+ /**
80
+ * Registers an event handler.
81
+ *
82
+ * @param event - The event type to listen for
83
+ * @param handler - The callback function
84
+ */
85
+ on(event: LidarControlEvent, handler: LidarControlEventHandler): void;
86
+ /**
87
+ * Removes an event handler.
88
+ *
89
+ * @param event - The event type
90
+ * @param handler - The callback function to remove
91
+ */
92
+ off(event: LidarControlEvent, handler: LidarControlEventHandler): void;
93
+ /**
94
+ * Gets the map instance.
95
+ *
96
+ * @returns The MapLibre GL map instance or undefined if not added to a map
97
+ */
98
+ getMap(): MapLibreMap | undefined;
99
+ /**
100
+ * Gets the control container element.
101
+ *
102
+ * @returns The container element or undefined if not added to a map
103
+ */
104
+ getContainer(): HTMLElement | undefined;
105
+ /**
106
+ * Gets the deck.gl overlay instance.
107
+ *
108
+ * @returns The DeckOverlay or undefined if not added to a map
109
+ */
110
+ getDeckOverlay(): DeckOverlay | undefined;
111
+ /**
112
+ * Loads a point cloud from a URL, File, or ArrayBuffer.
113
+ * For COPC files loaded from URL, defaults to dynamic streaming mode.
114
+ * Non-COPC files or local files use full download mode.
115
+ *
116
+ * @param source - URL string, File object, or ArrayBuffer
117
+ * @param options - Optional loading options including loadingMode override
118
+ * @returns Promise resolving to the point cloud info
119
+ */
120
+ loadPointCloud(source: string | File | ArrayBuffer, options?: {
121
+ loadingMode?: CopcLoadingMode;
122
+ }): Promise<PointCloudInfo>;
123
+ /**
124
+ * Unloads a point cloud.
125
+ *
126
+ * @param id - ID of the point cloud to unload (or undefined to unload all)
127
+ */
128
+ unloadPointCloud(id?: string): void;
129
+ /**
130
+ * Loads a point cloud using streaming (on-demand) loading.
131
+ * Ideal for large COPC files - supports both URLs and local files.
132
+ * Points are loaded dynamically based on viewport and zoom level.
133
+ *
134
+ * @param source - URL string, File object, or ArrayBuffer
135
+ * @param options - Optional streaming options
136
+ * @returns Promise resolving to initial point cloud info
137
+ */
138
+ loadPointCloudStreaming(source: string | File | ArrayBuffer, options?: StreamingLoaderOptions): Promise<PointCloudInfo>;
139
+ /**
140
+ * Downloads a file from URL and loads it fully.
141
+ * Used as fallback when streaming fails due to CORS.
142
+ */
143
+ private _loadPointCloudFullDownload;
144
+ /**
145
+ * Handles viewport changes for streaming mode.
146
+ * Selects and loads nodes based on current viewport.
147
+ *
148
+ * @param viewport - Current viewport information
149
+ * @param datasetId - ID of the dataset to load nodes for
150
+ */
151
+ private _handleViewportChangeForStreaming;
152
+ /**
153
+ * Stops streaming loading and cleans up resources.
154
+ *
155
+ * @param id - Optional ID of specific streaming dataset to stop. If not provided, stops all.
156
+ */
157
+ stopStreaming(id?: string): void;
158
+ /**
159
+ * Checks if streaming mode is currently active.
160
+ *
161
+ * @param id - Optional ID to check specific dataset. If not provided, checks if any streaming is active.
162
+ * @returns True if streaming is active
163
+ */
164
+ isStreaming(id?: string): boolean;
165
+ /**
166
+ * Gets the current streaming progress.
167
+ *
168
+ * @returns Streaming progress or undefined if not streaming
169
+ */
170
+ getStreamingProgress(): LidarState['streamingProgress'];
171
+ /**
172
+ * Sets the point size.
173
+ *
174
+ * @param size - Point size in pixels
175
+ */
176
+ setPointSize(size: number): void;
177
+ /**
178
+ * Sets the opacity.
179
+ *
180
+ * @param opacity - Opacity value (0-1)
181
+ */
182
+ setOpacity(opacity: number): void;
183
+ /**
184
+ * Sets the color scheme.
185
+ *
186
+ * @param scheme - Color scheme to apply
187
+ */
188
+ setColorScheme(scheme: ColorScheme): void;
189
+ /**
190
+ * Sets whether to use percentile range for elevation/intensity coloring.
191
+ *
192
+ * @param usePercentile - Whether to use percentile range (2-98%)
193
+ */
194
+ setUsePercentile(usePercentile: boolean): void;
195
+ /**
196
+ * Gets whether percentile range is being used for coloring.
197
+ *
198
+ * @returns True if using percentile range
199
+ */
200
+ getUsePercentile(): boolean;
201
+ /**
202
+ * Sets the elevation range filter.
203
+ *
204
+ * @param min - Minimum elevation
205
+ * @param max - Maximum elevation
206
+ */
207
+ setElevationRange(min: number, max: number): void;
208
+ /**
209
+ * Clears the elevation range filter.
210
+ */
211
+ clearElevationRange(): void;
212
+ /**
213
+ * Sets the point budget.
214
+ *
215
+ * @param budget - Maximum number of points to display
216
+ */
217
+ setPointBudget(budget: number): void;
218
+ /**
219
+ * Sets whether points are pickable (enables hover/click interactions).
220
+ *
221
+ * @param pickable - Whether points should be pickable
222
+ */
223
+ setPickable(pickable: boolean): void;
224
+ /**
225
+ * Sets whether Z offset adjustment is enabled.
226
+ *
227
+ * @param enabled - Whether Z offset is enabled
228
+ */
229
+ setZOffsetEnabled(enabled: boolean): void;
230
+ /**
231
+ * Sets the Z offset value for vertical adjustment.
232
+ *
233
+ * @param offset - Z offset in meters
234
+ */
235
+ setZOffset(offset: number): void;
236
+ /**
237
+ * Gets the current Z offset value.
238
+ *
239
+ * @returns Z offset in meters
240
+ */
241
+ getZOffset(): number;
242
+ /**
243
+ * Gets information about loaded point clouds.
244
+ *
245
+ * @returns Array of point cloud info objects
246
+ */
247
+ getPointClouds(): PointCloudInfo[];
248
+ /**
249
+ * Flies the map to a point cloud's bounds.
250
+ *
251
+ * @param id - ID of the point cloud (or undefined for active/first)
252
+ */
253
+ flyToPointCloud(id?: string): void;
254
+ /**
255
+ * Emits an event to all registered handlers.
256
+ *
257
+ * @param event - The event type to emit
258
+ */
259
+ private _emit;
260
+ /**
261
+ * Emits an event with additional data.
262
+ *
263
+ * @param event - The event type to emit
264
+ * @param data - Additional event data
265
+ */
266
+ private _emitWithData;
267
+ /**
268
+ * Creates the main container element for the control.
269
+ *
270
+ * @returns The container element
271
+ */
272
+ private _createContainer;
273
+ /**
274
+ * Creates the panel element with header and content areas.
275
+ *
276
+ * @returns The panel element
277
+ */
278
+ private _createPanel;
279
+ /**
280
+ * Creates the tooltip element for point picking.
281
+ *
282
+ * @returns The tooltip element
283
+ */
284
+ private _createTooltip;
285
+ /**
286
+ * Formats a GPS time value (GPS Week Seconds) to a readable string.
287
+ */
288
+ private _formatGpsTime;
289
+ /**
290
+ * Formats a value for display in the tooltip.
291
+ */
292
+ private _formatAttributeValue;
293
+ /**
294
+ * Gets the classification name for a code.
295
+ */
296
+ private _getClassificationName;
297
+ /**
298
+ * Checks if an attribute should be shown based on pickInfoFields config.
299
+ */
300
+ private _shouldShowAttribute;
301
+ /**
302
+ * Handles point hover events from the point cloud layer.
303
+ *
304
+ * @param info - Picked point information or null if no point
305
+ */
306
+ private _handlePointHover;
307
+ /**
308
+ * Sets which fields to display in the pick point info panel.
309
+ *
310
+ * @param fields - Array of attribute names to show, or undefined/empty to show all
311
+ */
312
+ setPickInfoFields(fields?: string[]): void;
313
+ /**
314
+ * Gets the current list of fields shown in pick point info.
315
+ */
316
+ getPickInfoFields(): string[] | undefined;
317
+ }
318
+ //# sourceMappingURL=LidarControl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LidarControl.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/LidarControl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EACV,iBAAiB,EACjB,wBAAwB,EAExB,cAAc,EACd,WAAW,EACX,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,OAAO,KA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AAI,IAAI;IAO3B;;;;OAIG;IACH,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAKpC;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAOpC;;;;OAIG;IACH,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAWzC;;;;OAIG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAOhC;;;;OAIG;IACH,UAAU,IAAI,MAAM;IAIpB;;;;OAIG;IACH,cAAc,IAAI,cAAc,EAAE;IAIlC;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IA8BlC;;;;OAIG;IACH,OAAO,CAAC,KAAK;IAQb;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IAQrB;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAiCxB;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAwDpB;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAoBtB;;OAEG;IACH,OAAO,CAAC,cAAc;IAgBtB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAgC7B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAyB9B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAS5B;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IA2DzB;;;;OAIG;IACH,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI;IAK1C;;OAEG;IACH,iBAAiB,IAAI,MAAM,EAAE,GAAG,SAAS;CAG1C"}
@@ -0,0 +1,35 @@
1
+ import { LidarControlReactProps } from './types';
2
+ /**
3
+ * React wrapper component for LidarControl.
4
+ *
5
+ * This component manages the lifecycle of a LidarControl instance,
6
+ * adding it to the map on mount and removing it on unmount.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * import { LidarControlReact } from 'maplibre-gl-lidar/react';
11
+ *
12
+ * function MyMap() {
13
+ * const [map, setMap] = useState<Map | null>(null);
14
+ *
15
+ * return (
16
+ * <>
17
+ * <div ref={mapContainer} />
18
+ * {map && (
19
+ * <LidarControlReact
20
+ * map={map}
21
+ * title="LiDAR Viewer"
22
+ * collapsed={false}
23
+ * onLoad={(pc) => console.log('Loaded:', pc)}
24
+ * />
25
+ * )}
26
+ * </>
27
+ * );
28
+ * }
29
+ * ```
30
+ *
31
+ * @param props - Component props including map instance and control options
32
+ * @returns null - This component renders nothing directly
33
+ */
34
+ export declare function LidarControlReact({ map, onStateChange, onLoad, onError, ...options }: LidarControlReactProps): null;
35
+ //# sourceMappingURL=LidarControlReact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LidarControlReact.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/LidarControlReact.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,GAAG,EACH,aAAa,EACb,MAAM,EACN,OAAO,EACP,GAAG,OAAO,EACX,EAAE,sBAAsB,GAAG,IAAI,CA0E/B"}
@@ -0,0 +1,105 @@
1
+ import { Map as MapLibreMap } from 'maplibre-gl';
2
+ import { ViewportInfo } from '../loaders/streaming-types';
3
+ /**
4
+ * Options for the ViewportManager
5
+ */
6
+ export interface ViewportManagerOptions {
7
+ /**
8
+ * Debounce time for viewport changes in ms
9
+ * @default 150
10
+ */
11
+ debounceMs?: number;
12
+ /**
13
+ * Minimum zoom level to start loading high-detail nodes
14
+ * @default 10
15
+ */
16
+ minDetailZoom?: number;
17
+ /**
18
+ * Maximum octree depth to load
19
+ * @default 20
20
+ */
21
+ maxOctreeDepth?: number;
22
+ /**
23
+ * Octree spacing value from COPC file (for more accurate depth calculation)
24
+ */
25
+ spacing?: number;
26
+ }
27
+ /**
28
+ * Manages viewport state and triggers node loading based on map view changes.
29
+ * Listens to MapLibre GL map events and calculates the appropriate octree
30
+ * depth for the current zoom level and pitch.
31
+ */
32
+ export declare class ViewportManager {
33
+ private _map;
34
+ private _debounceMs;
35
+ private _onViewportChange;
36
+ private _debouncedHandler;
37
+ private _isActive;
38
+ private _minDetailZoom;
39
+ private _maxOctreeDepth;
40
+ private _spacing;
41
+ /**
42
+ * Creates a new ViewportManager instance.
43
+ *
44
+ * @param map - MapLibre GL map instance
45
+ * @param onViewportChange - Callback fired when viewport changes
46
+ * @param options - Configuration options
47
+ */
48
+ constructor(map: MapLibreMap, onViewportChange: (viewport: ViewportInfo) => void, options?: ViewportManagerOptions);
49
+ /**
50
+ * Starts listening to map viewport changes.
51
+ */
52
+ start(): void;
53
+ /**
54
+ * Stops listening to map viewport changes.
55
+ */
56
+ stop(): void;
57
+ /**
58
+ * Gets the current viewport information.
59
+ *
60
+ * @returns ViewportInfo object with bounds, center, zoom, pitch, and targetDepth
61
+ */
62
+ getCurrentViewport(): ViewportInfo;
63
+ /**
64
+ * Calculates target octree depth based on zoom level and pitch.
65
+ *
66
+ * Mapping strategy:
67
+ * - Zoom 0-10: depth 0-2 (overview)
68
+ * - Zoom 10-14: depth 2-6 (city level)
69
+ * - Zoom 14-18: depth 6-12 (block level)
70
+ * - Zoom 18+: depth 12+ (detail level)
71
+ *
72
+ * Pitch adjustment: higher pitch (3D view) reduces depth to avoid
73
+ * loading too many nodes in the distance.
74
+ *
75
+ * @param zoom - Current map zoom level
76
+ * @param pitch - Current map pitch in degrees
77
+ * @returns Target octree depth
78
+ */
79
+ private _calculateTargetDepth;
80
+ /**
81
+ * Handles viewport change events.
82
+ */
83
+ private _handleViewportChange;
84
+ /**
85
+ * Forces a viewport update (e.g., after initial data load or fly animation).
86
+ */
87
+ forceUpdate(): void;
88
+ /**
89
+ * Updates the spacing value used for depth calculation.
90
+ *
91
+ * @param spacing - Octree spacing from COPC file
92
+ */
93
+ setSpacing(spacing: number): void;
94
+ /**
95
+ * Checks if the viewport manager is currently active.
96
+ *
97
+ * @returns True if listening for viewport changes
98
+ */
99
+ isActive(): boolean;
100
+ /**
101
+ * Destroys the viewport manager and removes all event listeners.
102
+ */
103
+ destroy(): void;
104
+ }
105
+ //# sourceMappingURL=ViewportManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ViewportManager.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/ViewportManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG/D;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,IAAI,CAAc;IAC1B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,iBAAiB,CAAmC;IAC5D,OAAO,CAAC,iBAAiB,CAAa;IACtC,OAAO,CAAC,SAAS,CAAkB;IAGnC,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAgB;IAEhC;;;;;;OAMG;gBAED,GAAG,EAAE,WAAW,EAChB,gBAAgB,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,IAAI,EAClD,OAAO,CAAC,EAAE,sBAAsB;IAelC;;OAEG;IACH,KAAK,IAAI,IAAI;IAYb;;OAEG;IACH,IAAI,IAAI,IAAI;IASZ;;;;OAIG;IACH,kBAAkB,IAAI,YAAY;IAoBlC;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,qBAAqB;IAwC7B;;OAEG;IACH,OAAO,C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