@feltmaps/js-sdk 1.6.0-next.1 → 1.6.0-next.2
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/dist/client.cjs +1 -1
- package/dist/client.d.cts +3 -1012
- package/dist/client.d.ts +3 -1012
- package/dist/client.js +1 -1
- package/dist/{types-0PFYQhMS.d.cts → controller-C5gGWnaM.d.cts} +1026 -20
- package/dist/{types-0PFYQhMS.d.ts → controller-C5gGWnaM.d.ts} +1026 -20
- package/dist/handler.cjs +1 -1
- package/dist/handler.d.cts +91 -72
- package/dist/handler.d.ts +91 -72
- package/dist/handler.js +1 -1
- package/package.json +3 -3
- package/handler.d.ts +0 -4311
- package/handler.js +0 -1
- package/types-0PFYQhMS.d.ts +0 -7510
package/dist/client.d.cts
CHANGED
|
@@ -1,1016 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { z as zInfer, U as UiControlsOptions, V as ViewportCenterZoom, F as FeltController } from './controller-C5gGWnaM.cjs';
|
|
2
|
+
export { au as AggregationConfig, av as AggregationMethod, C as CircleElementCreate, a as CircleElementRead, b as CircleElementUpdate, b2 as CircleToolSettings, b3 as ConfigurableToolType, K as CreateLayersFromGeoJsonParams, O as DataOnlyLayer, E as Element, c as ElementChangeCallbackParams, d as ElementCreate, e as ElementGroup, f as ElementGroupChangeCallbackParams, aG as ElementGroupNode, aH as ElementNode, g as ElementUpdate, B as ElementsController, aI as EntityNode, aJ as FeatureNode, aK as FeatureSelection, aO as FeltBoundary, Q as FeltTiledVectorSource, aP as FeltZoom, an as FilterExpression, ao as FilterLogicGate, ap as FilterTernary, aq as Filters, R as GeoJsonDataVectorSource, aQ as GeoJsonFeature, S as GeoJsonFileVectorSource, aR as GeoJsonGeometry, aS as GeoJsonProperties, W as GeoJsonUrlVectorSource, ar as GeometryFilter, G as GetElementGroupsConstraint, h as GetElementsConstraint, aw as GetLayerCalculationParams, ax as GetLayerCategoriesGroup, ay as GetLayerCategoriesParams, X as GetLayerGroupsConstraint, az as GetLayerHistogramBin, aA as GetLayerHistogramParams, Y as GetLayersConstraint, Z as GetRenderedFeaturesConstraint, H as HighlighterElementCreate, i as HighlighterElementRead, j as HighlighterElementUpdate, b4 as HighlighterToolSettings, I as ImageElementCreate, k as ImageElementRead, l as ImageElementUpdate, b5 as InputToolSettings, J as InteractionsController, aT as LatLng, _ as Layer, as as LayerBoundaries, $ as LayerChangeCallbackParams, a0 as LayerCommon, ad as LayerFeature, at as LayerFilters, a1 as LayerGroup, a2 as LayerGroupChangeCallbackParams, aL as LayerGroupNode, aM as LayerNode, a3 as LayerProcessingStatus, af as LayerSchema, ag as LayerSchemaAttribute, ah as LayerSchemaBooleanAttribute, ai as LayerSchemaCommonAttribute, aj as LayerSchemaDateAttribute, ak as LayerSchemaDateTimeAttribute, al as LayerSchemaNumericAttribute, am as LayerSchemaTextAttribute, aD as LayersController, a4 as LegendItem, a5 as LegendItemChangeCallbackParams, a6 as LegendItemIdentifier, a7 as LegendItemsConstraint, aU as LineStringGeometry, b6 as LineToolSettings, L as LinkElementRead, aV as LngLatTuple, aE as MapDetails, D as MapInteractionEvent, M as MarkerElementCreate, m as MarkerElementRead, n as MarkerElementUpdate, b7 as MarkerToolSettings, aF as MiscController, aB as MultiAggregationConfig, aW as MultiLineStringGeometry, aX as MultiPointGeometry, aY as MultiPolygonGeometry, N as NoteElementCreate, o as NoteElementRead, p as NoteElementUpdate, b8 as NoteToolSettings, bj as OnMapInteractionsOptions, P as PathElementCreate, q as PathElementRead, r as PathElementUpdate, b9 as PinToolSettings, s as PlaceElementCreate, t as PlaceElementRead, u as PlaceElementUpdate, ba as PlaceFrame, bb as PlaceSymbol, aZ as PointGeometry, v as PolygonElementCreate, w as PolygonElementRead, x as PolygonElementUpdate, a_ as PolygonGeometry, bc as PolygonToolSettings, a8 as RasterBand, a9 as RasterLayer, aa as RasterLayerSource, ae as RasterValue, bd as RouteToolSettings, aN as SelectionController, bl as SetViewportCenterZoomParams, a$ as SetVisibilityRequest, b0 as SortConfig, b1 as SortDirection, T as TextElementCreate, y as TextElementRead, A as TextElementUpdate, be as TextToolSettings, bf as ToolSettingsChangeEvent, bg as ToolSettingsMap, bh as ToolType, bi as ToolsController, bk as UiController, ab as UpdateLayerParams, aC as ValueConfiguration, ac as VectorLayer, bm as ViewportConstraints, bp as ViewportController, bn as ViewportFitBoundsParams, bo as ViewportState } from './controller-C5gGWnaM.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* The Elements controller allows you to get information about the elements on the
|
|
7
|
-
* map, and make changes to their visibility.
|
|
8
|
-
*
|
|
9
|
-
* @group Controller
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
interface ElementsController {
|
|
13
|
-
/**
|
|
14
|
-
* Get a single element from the map by its id.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* const element = await felt.getElement("element-1");
|
|
19
|
-
* ```
|
|
20
|
-
* @returns The requested element.
|
|
21
|
-
*/
|
|
22
|
-
getElement(
|
|
23
|
-
/**
|
|
24
|
-
* The id of the element you want to get.
|
|
25
|
-
*/
|
|
26
|
-
id: string): Promise<Element | null>;
|
|
27
|
-
/**
|
|
28
|
-
* Get the geometry of an element in GeoJSON geometry format.
|
|
29
|
-
*
|
|
30
|
-
* For most element types, the geometry returned is based on the `coordinates`
|
|
31
|
-
* property of the element, with some differences:
|
|
32
|
-
*
|
|
33
|
-
* - For Circle elements, the geometry is a Polygon drawn from the `center` and
|
|
34
|
-
* `radius` properties.
|
|
35
|
-
*
|
|
36
|
-
* - Path elements become MultiLineString geometries.
|
|
37
|
-
*
|
|
38
|
-
* - Marker elements return a MultiLineString of the path traced by the user
|
|
39
|
-
* as they drew the marker. Note that this is not the polygon formed by filled-in
|
|
40
|
-
* "pen" stroke, which doesn't exactly follow the path traced by the user as it
|
|
41
|
-
* is smoothed and interpolated to create a continuous line.
|
|
42
|
-
*
|
|
43
|
-
* - Text, Note and Image elements do not return geometry, so will return `null`.
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```typescript
|
|
48
|
-
* const geometry = await felt.getElementGeometry("element-1");
|
|
49
|
-
* console.log(geometry?.type, geometry?.coordinates);
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
getElementGeometry(
|
|
53
|
-
/**
|
|
54
|
-
* The id of the element you want to get the geometry of.
|
|
55
|
-
*/
|
|
56
|
-
id: string): Promise<GeoJsonGeometry | null>;
|
|
57
|
-
/**
|
|
58
|
-
* Gets elements from the map, according to the constraints supplied. If no
|
|
59
|
-
* constraints are supplied, all elements will be returned.
|
|
60
|
-
*
|
|
61
|
-
* @remarks The elements in the map, ordered by the order specified in Felt. This is not
|
|
62
|
-
* necessarily the order that they are drawn in, as Felt draws points above
|
|
63
|
-
* lines and lines above polygons, for instance.
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* ```typescript
|
|
67
|
-
* const elements = await felt.getElements();
|
|
68
|
-
* ```
|
|
69
|
-
* @returns All elements on the map.
|
|
70
|
-
*/
|
|
71
|
-
getElements(
|
|
72
|
-
/**
|
|
73
|
-
* The constraints to apply to the elements returned from the map.
|
|
74
|
-
*/
|
|
75
|
-
constraint?: GetElementsConstraint): Promise<Array<Element | null>>;
|
|
76
|
-
/**
|
|
77
|
-
* Get an element group from the map by its id.
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* ```typescript
|
|
81
|
-
* const elementGroup = await felt.getElementGroup("element-group-1");
|
|
82
|
-
* ```
|
|
83
|
-
* @returns The requested element group.
|
|
84
|
-
*/
|
|
85
|
-
getElementGroup(id: string): Promise<ElementGroup | null>;
|
|
86
|
-
/**
|
|
87
|
-
* Gets element groups from the map, according to the filters supplied. If no
|
|
88
|
-
* constraints are supplied, all element groups will be returned in rendering order.
|
|
89
|
-
*
|
|
90
|
-
* @example
|
|
91
|
-
* ```typescript
|
|
92
|
-
* const elementGroups = await felt.getElementGroups({ ids: ["element-group-1", "element-group-2"] });
|
|
93
|
-
* ```
|
|
94
|
-
* @returns The requested element groups.
|
|
95
|
-
*/
|
|
96
|
-
getElementGroups(
|
|
97
|
-
/**
|
|
98
|
-
* The constraints to apply to the element groups returned from the map.
|
|
99
|
-
*/
|
|
100
|
-
constraint?: GetElementGroupsConstraint): Promise<Array<ElementGroup | null>>;
|
|
101
|
-
/**
|
|
102
|
-
* Hide or show element groups with the given ids.
|
|
103
|
-
*
|
|
104
|
-
* @example
|
|
105
|
-
* ```typescript
|
|
106
|
-
* felt.setElementGroupVisibility({ show: ["element-group-1", "element-group-2"], hide: ["element-group-3"] });
|
|
107
|
-
* ```
|
|
108
|
-
*/
|
|
109
|
-
setElementGroupVisibility(visibility: SetVisibilityRequest): Promise<void>;
|
|
110
|
-
/**
|
|
111
|
-
* Adds a listener for when an element is created.
|
|
112
|
-
*
|
|
113
|
-
* @returns A function to unsubscribe from the listener
|
|
114
|
-
*
|
|
115
|
-
* @event
|
|
116
|
-
* @example
|
|
117
|
-
* ```typescript
|
|
118
|
-
* const unsubscribe = felt.onElementCreate({
|
|
119
|
-
* handler: (element) => console.log(element.id),
|
|
120
|
-
* });
|
|
121
|
-
*
|
|
122
|
-
* // later on...
|
|
123
|
-
* unsubscribe();
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
126
|
-
onElementCreate(args: {
|
|
127
|
-
/**
|
|
128
|
-
* The handler that is called when an element is created.
|
|
129
|
-
*
|
|
130
|
-
* This will fire when elements are created programatically, or when the
|
|
131
|
-
* user starts creating an element with a drawing tool.
|
|
132
|
-
*
|
|
133
|
-
* When the user creates an element with a drawing tool, it can begin in
|
|
134
|
-
* an invalid state, such as if you've just placed a single point in a polygon.
|
|
135
|
-
*
|
|
136
|
-
* You can use the `isBeingCreated` property to determine if the element is
|
|
137
|
-
* still being created by a drawing tool.
|
|
138
|
-
*
|
|
139
|
-
* If you want to know when the element is finished being created, you can
|
|
140
|
-
* use the {@link ElementsController.onElementCreateEnd | `onElementCreateEnd`} listener.
|
|
141
|
-
*
|
|
142
|
-
* @param change - An object describing the change that occurred.
|
|
143
|
-
*/
|
|
144
|
-
handler: (change: ElementChangeCallbackParams) => void;
|
|
145
|
-
}): VoidFunction;
|
|
146
|
-
/**
|
|
147
|
-
* Listens for when a new element is finished being created by a drawing tool.
|
|
148
|
-
*
|
|
149
|
-
* This differs from the {@link ElementsController.onElementCreate | `onElementCreate`} listener, which fires whenever an
|
|
150
|
-
* element is first created. This fires when the user finishes creating an element
|
|
151
|
-
* which could be after a series of interactions.
|
|
152
|
-
*
|
|
153
|
-
* For example, when creating a polygon, the user places a series of points then
|
|
154
|
-
* finishes by pressing Enter or Escape. Or when creating a Place element, they
|
|
155
|
-
* add the marker, type a label, then finally deselect the element.
|
|
156
|
-
*
|
|
157
|
-
* @returns A function to unsubscribe from the listener
|
|
158
|
-
*
|
|
159
|
-
* @event
|
|
160
|
-
* @example
|
|
161
|
-
* ```typescript
|
|
162
|
-
* const unsubscribe = felt.onToolCreatedElement({
|
|
163
|
-
* handler: (params) => console.log(params),
|
|
164
|
-
* });
|
|
165
|
-
*
|
|
166
|
-
* // later on...
|
|
167
|
-
* unsubscribe();
|
|
168
|
-
* ```
|
|
169
|
-
*/
|
|
170
|
-
onElementCreateEnd(args: {
|
|
171
|
-
/**
|
|
172
|
-
* The handler to call whenever this event fires.
|
|
173
|
-
*
|
|
174
|
-
* @param params - An object containing the element that was created.
|
|
175
|
-
*/
|
|
176
|
-
handler: (params: {
|
|
177
|
-
element: Element;
|
|
178
|
-
}) => void;
|
|
179
|
-
}): VoidFunction;
|
|
180
|
-
/**
|
|
181
|
-
* Adds a listener for when an element changes.
|
|
182
|
-
*
|
|
183
|
-
* This will fire when an element is being edited, either on the map by the user
|
|
184
|
-
* or programatically.
|
|
185
|
-
*
|
|
186
|
-
* Like the {@link ElementsController.onElementCreate | `onElementCreate`} listener, this will fire when an element is
|
|
187
|
-
* still being created by a drawing tool.
|
|
188
|
-
*
|
|
189
|
-
* You can check the {@link ElementChangeCallbackParams.isBeingCreated | `isBeingCreated`} property to determine if the element is
|
|
190
|
-
* still being created by a drawing tool.
|
|
191
|
-
*
|
|
192
|
-
* @returns A function to unsubscribe from the listener
|
|
193
|
-
*
|
|
194
|
-
* @event
|
|
195
|
-
* @example
|
|
196
|
-
* ```typescript
|
|
197
|
-
* const unsubscribe = felt.onElementChange({
|
|
198
|
-
* options: { id: "element-1" },
|
|
199
|
-
* handler: ({element}) => console.log(element.id),
|
|
200
|
-
* });
|
|
201
|
-
*
|
|
202
|
-
* // later on...
|
|
203
|
-
* unsubscribe();
|
|
204
|
-
* ```
|
|
205
|
-
*/
|
|
206
|
-
onElementChange(args: {
|
|
207
|
-
options: {
|
|
208
|
-
/**
|
|
209
|
-
* The id of the element to listen for changes to.
|
|
210
|
-
*/
|
|
211
|
-
id: string;
|
|
212
|
-
};
|
|
213
|
-
/**
|
|
214
|
-
* The handler that is called when the element changes.
|
|
215
|
-
*/
|
|
216
|
-
handler: (
|
|
217
|
-
/**
|
|
218
|
-
* An object describing the change that occurred.
|
|
219
|
-
*/
|
|
220
|
-
change: ElementChangeCallbackParams) => void;
|
|
221
|
-
}): VoidFunction;
|
|
222
|
-
/**
|
|
223
|
-
* Adds a listener for when an element is deleted.
|
|
224
|
-
*
|
|
225
|
-
* @returns A function to unsubscribe from the listener
|
|
226
|
-
*
|
|
227
|
-
* @event
|
|
228
|
-
* @example
|
|
229
|
-
* ```typescript
|
|
230
|
-
* const unsubscribe = felt.onElementDelete({
|
|
231
|
-
* options: { id: "element-1" },
|
|
232
|
-
* handler: () => console.log("element-1 deleted"),
|
|
233
|
-
* });
|
|
234
|
-
*
|
|
235
|
-
* // later on...
|
|
236
|
-
* unsubscribe();
|
|
237
|
-
* ```
|
|
238
|
-
*/
|
|
239
|
-
onElementDelete(args: {
|
|
240
|
-
options: {
|
|
241
|
-
/**
|
|
242
|
-
* The id of the element to listen for deletions of.
|
|
243
|
-
*/
|
|
244
|
-
id: string;
|
|
245
|
-
};
|
|
246
|
-
/**
|
|
247
|
-
* The handler that is called when the element is deleted.
|
|
248
|
-
*/
|
|
249
|
-
handler: () => void;
|
|
250
|
-
}): VoidFunction;
|
|
251
|
-
/**
|
|
252
|
-
* Adds a listener for when an element group changes.
|
|
253
|
-
*
|
|
254
|
-
* @returns A function to unsubscribe from the listener
|
|
255
|
-
*
|
|
256
|
-
* @event
|
|
257
|
-
* @example
|
|
258
|
-
* ```typescript
|
|
259
|
-
* const unsubscribe = felt.onElementGroupChange({
|
|
260
|
-
* options: { id: "element-group-1" },
|
|
261
|
-
* handler: elementGroup => console.log(elementGroup.id),
|
|
262
|
-
* });
|
|
263
|
-
*
|
|
264
|
-
* // later on...
|
|
265
|
-
* unsubscribe();
|
|
266
|
-
* ```
|
|
267
|
-
*/
|
|
268
|
-
onElementGroupChange(args: {
|
|
269
|
-
options: {
|
|
270
|
-
id: string;
|
|
271
|
-
};
|
|
272
|
-
handler: (change: ElementGroupChangeCallbackParams) => void;
|
|
273
|
-
}): VoidFunction;
|
|
274
|
-
/**
|
|
275
|
-
* Create a new element on the map.
|
|
276
|
-
*
|
|
277
|
-
* @example
|
|
278
|
-
* ```typescript
|
|
279
|
-
* const element = await felt.createElement({ type: "Place", coordinates: [10, 10] });
|
|
280
|
-
* ```
|
|
281
|
-
*/
|
|
282
|
-
createElement(element: ElementCreate): Promise<Element>;
|
|
283
|
-
/**
|
|
284
|
-
* Update an element on the map.
|
|
285
|
-
*
|
|
286
|
-
* @example
|
|
287
|
-
* ```typescript
|
|
288
|
-
* // Update a place element's coordinates
|
|
289
|
-
* await felt.updateElement({
|
|
290
|
-
* id: "element-1",
|
|
291
|
-
* coordinates: [10, 20]
|
|
292
|
-
* });
|
|
293
|
-
*
|
|
294
|
-
* // Update a polygon's style
|
|
295
|
-
* await felt.updateElement({
|
|
296
|
-
* id: "element-2",
|
|
297
|
-
* color: "#ABC123",
|
|
298
|
-
* fillOpacity: 0.5
|
|
299
|
-
* });
|
|
300
|
-
* ```
|
|
301
|
-
*/
|
|
302
|
-
updateElement(element: ElementUpdate): Promise<Element>;
|
|
303
|
-
/**
|
|
304
|
-
* Delete an element from the map.
|
|
305
|
-
*
|
|
306
|
-
* @example
|
|
307
|
-
* ```typescript
|
|
308
|
-
* await felt.deleteElement("element-1");
|
|
309
|
-
* ```
|
|
310
|
-
*/
|
|
311
|
-
deleteElement(id: string): Promise<void>;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* The Interactions controller allows you to observe interactions with the map
|
|
316
|
-
*
|
|
317
|
-
* @group Controller
|
|
318
|
-
* @public
|
|
319
|
-
*/
|
|
320
|
-
interface InteractionsController {
|
|
321
|
-
/**
|
|
322
|
-
* Allows you to be notified the user clicks on the map.
|
|
323
|
-
*
|
|
324
|
-
* @returns A function to unsubscribe from the listener
|
|
325
|
-
*
|
|
326
|
-
* @event
|
|
327
|
-
* @example
|
|
328
|
-
* ```typescript
|
|
329
|
-
* const unsubscribe = felt.onPointerClick({
|
|
330
|
-
* handler: (event) => console.log(event.center, event.features),
|
|
331
|
-
* });
|
|
332
|
-
*
|
|
333
|
-
* // later on...
|
|
334
|
-
* unsubscribe();
|
|
335
|
-
* ```
|
|
336
|
-
*/
|
|
337
|
-
onPointerClick(params: {
|
|
338
|
-
handler: (event: MapInteractionEvent) => void;
|
|
339
|
-
}): VoidFunction;
|
|
340
|
-
/**
|
|
341
|
-
* Allows you to be notified the user moves the mouse over the map.
|
|
342
|
-
*
|
|
343
|
-
* @returns A function to unsubscribe from the listener
|
|
344
|
-
*
|
|
345
|
-
* @event
|
|
346
|
-
* @example
|
|
347
|
-
* ```typescript
|
|
348
|
-
* // Track mouse movement and features under cursor
|
|
349
|
-
* const unsubscribe = felt.onPointerMove({
|
|
350
|
-
* handler: (event) => {
|
|
351
|
-
* console.log("Mouse position:", event.center);
|
|
352
|
-
* console.log("Features under cursor:", event.features);
|
|
353
|
-
* }
|
|
354
|
-
* });
|
|
355
|
-
*
|
|
356
|
-
* // later on...
|
|
357
|
-
* unsubscribe();
|
|
358
|
-
* ```
|
|
359
|
-
*/
|
|
360
|
-
onPointerMove(
|
|
361
|
-
/**
|
|
362
|
-
* Params for the listener
|
|
363
|
-
*/
|
|
364
|
-
params: {
|
|
365
|
-
/**
|
|
366
|
-
* The handler function
|
|
367
|
-
*/
|
|
368
|
-
handler: (event: MapInteractionEvent) => void;
|
|
369
|
-
}): VoidFunction;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* @group Controller
|
|
374
|
-
* @public
|
|
375
|
-
*/
|
|
376
|
-
interface MiscController {
|
|
377
|
-
/**
|
|
378
|
-
* Gets the details of the map.
|
|
379
|
-
*
|
|
380
|
-
* @example
|
|
381
|
-
* ```typescript
|
|
382
|
-
* const details = await felt.getMapDetails();
|
|
383
|
-
* console.log({
|
|
384
|
-
* id: details.id,
|
|
385
|
-
* title: details.title,
|
|
386
|
-
* description: details.description,
|
|
387
|
-
* });
|
|
388
|
-
* ```
|
|
389
|
-
*/
|
|
390
|
-
getMapDetails(): Promise<MapDetails>;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
/**
|
|
394
|
-
* The Selection controller allows you to listen for changes to the selection on the map.
|
|
395
|
-
*
|
|
396
|
-
* @group Controller
|
|
397
|
-
* @public
|
|
398
|
-
*/
|
|
399
|
-
interface SelectionController {
|
|
400
|
-
/**
|
|
401
|
-
* Gets the current selection as a list of entity identifiers.
|
|
402
|
-
*
|
|
403
|
-
* @example
|
|
404
|
-
* ```typescript
|
|
405
|
-
* const selection = await felt.getSelection();
|
|
406
|
-
* ```
|
|
407
|
-
*/
|
|
408
|
-
getSelection(): Promise<EntityNode[]>;
|
|
409
|
-
/**
|
|
410
|
-
* Adds a listener for when the selection changes.
|
|
411
|
-
*
|
|
412
|
-
* @returns A function to unsubscribe from the listener
|
|
413
|
-
*
|
|
414
|
-
* @event
|
|
415
|
-
* @example
|
|
416
|
-
* ```typescript
|
|
417
|
-
* const unsubscribe = felt.onSelectionChange({
|
|
418
|
-
* handler: ({selection}) => console.log(selection),
|
|
419
|
-
* });
|
|
420
|
-
*
|
|
421
|
-
* // later on...
|
|
422
|
-
* unsubscribe();
|
|
423
|
-
* ```
|
|
424
|
-
*/
|
|
425
|
-
onSelectionChange(params: {
|
|
426
|
-
handler: (change: {
|
|
427
|
-
/**
|
|
428
|
-
* The new selection. In the case where there are multiple entities selected,
|
|
429
|
-
* the array describes the chronological and semeantic order of the selection.
|
|
430
|
-
*
|
|
431
|
-
* Entities of the same type that are selected later will appear later in the
|
|
432
|
-
* list, but there are cases where multiple entity types can be selected at once,
|
|
433
|
-
* such as elements and features. In this case, the order of the _types_ of entities
|
|
434
|
-
* tells you which are considered more semantically important.
|
|
435
|
-
*
|
|
436
|
-
* For example, if a feature and element are selected, the feature will be at the
|
|
437
|
-
* tail of the list because pressing Escape will deselect the feature first, then
|
|
438
|
-
* pressing Escape again will deselect the element.
|
|
439
|
-
*/
|
|
440
|
-
selection: EntityNode[];
|
|
441
|
-
}) => void;
|
|
442
|
-
}): VoidFunction;
|
|
443
|
-
/**
|
|
444
|
-
* Selects a feature on a layer. This will show the feature's popup, modal or
|
|
445
|
-
* sidebar (if configured) and highlight the feature.
|
|
446
|
-
*
|
|
447
|
-
* @example
|
|
448
|
-
* ```typescript
|
|
449
|
-
* felt.selectFeature({
|
|
450
|
-
* id: 123,
|
|
451
|
-
* layerId: "my-layer",
|
|
452
|
-
* showPopup: true,
|
|
453
|
-
* fitViewport: { maxZoom: 15 },
|
|
454
|
-
* });
|
|
455
|
-
* ```
|
|
456
|
-
*/
|
|
457
|
-
selectFeature(params: FeatureSelection): Promise<void>;
|
|
458
|
-
/**
|
|
459
|
-
* Clears the current selection. This clears the selection of
|
|
460
|
-
*
|
|
461
|
-
* @example
|
|
462
|
-
* ```typescript
|
|
463
|
-
*
|
|
464
|
-
* // Removes all features and elements from the selection
|
|
465
|
-
* felt.clearSelection();
|
|
466
|
-
*
|
|
467
|
-
* // Removes only features from the selection
|
|
468
|
-
* felt.clearSelection({ features: true });
|
|
469
|
-
*
|
|
470
|
-
* // Removes only elements from the selection
|
|
471
|
-
* felt.clearSelection({ elements: true });
|
|
472
|
-
* ```
|
|
473
|
-
*
|
|
474
|
-
* @default
|
|
475
|
-
* ```typescript
|
|
476
|
-
* { features: true, elements: true }
|
|
477
|
-
* ```
|
|
478
|
-
*
|
|
479
|
-
* @param params - The parameters to clear the selection. If this is not provided,
|
|
480
|
-
* both features and elements will be cleared.
|
|
481
|
-
*/
|
|
482
|
-
clearSelection(params?: {
|
|
483
|
-
/**
|
|
484
|
-
* Whether to clear the features from the selection.
|
|
485
|
-
*/
|
|
486
|
-
features?: boolean;
|
|
487
|
-
/**
|
|
488
|
-
* Whether to clear the elements from the selection.
|
|
489
|
-
*/
|
|
490
|
-
elements?: boolean;
|
|
491
|
-
}): Promise<void>;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
/**
|
|
495
|
-
* The Tools controller allows you to let users draw elements on the map.
|
|
496
|
-
*
|
|
497
|
-
* @group Controller
|
|
498
|
-
* @public
|
|
499
|
-
*/
|
|
500
|
-
interface ToolsController {
|
|
501
|
-
/**
|
|
502
|
-
* Sets the tool to use for drawing elements on the map.
|
|
503
|
-
*
|
|
504
|
-
* @param tool - The tool to set.
|
|
505
|
-
*
|
|
506
|
-
* @example
|
|
507
|
-
* ```typescript
|
|
508
|
-
* // Set the tool to "marker"
|
|
509
|
-
* await felt.setTool("marker");
|
|
510
|
-
*
|
|
511
|
-
* // put down the tool
|
|
512
|
-
* await felt.setTool(null);
|
|
513
|
-
* ```
|
|
514
|
-
*/
|
|
515
|
-
setTool(tool: ToolType | null): void;
|
|
516
|
-
/**
|
|
517
|
-
* Gets the current tool, if any is in use.
|
|
518
|
-
*
|
|
519
|
-
* @returns The current tool, or `null` if no tool is in use.
|
|
520
|
-
*
|
|
521
|
-
* @example
|
|
522
|
-
* ```typescript
|
|
523
|
-
* const tool = await felt.getTool(); // "marker", "polygon", etc.
|
|
524
|
-
* ```
|
|
525
|
-
*/
|
|
526
|
-
getTool(): Promise<ToolType | null>;
|
|
527
|
-
/**
|
|
528
|
-
* Listens for changes to the current tool.
|
|
529
|
-
*
|
|
530
|
-
* @returns A function to unsubscribe from the listener
|
|
531
|
-
*
|
|
532
|
-
* @example
|
|
533
|
-
* ```typescript
|
|
534
|
-
* const unsubscribe = felt.onToolChange({
|
|
535
|
-
* handler: tool => console.log(tool),
|
|
536
|
-
* });
|
|
537
|
-
*
|
|
538
|
-
* // later on...
|
|
539
|
-
* unsubscribe();
|
|
540
|
-
* ```
|
|
541
|
-
*/
|
|
542
|
-
onToolChange(args: {
|
|
543
|
-
/**
|
|
544
|
-
* This callback is called with the current tool whenever the tool changes.
|
|
545
|
-
*
|
|
546
|
-
* @param tool - The current tool, or `null` if no tool is in use.
|
|
547
|
-
*/
|
|
548
|
-
handler: (tool: ToolType | null) => void;
|
|
549
|
-
}): VoidFunction;
|
|
550
|
-
/**
|
|
551
|
-
* Sets the settings for the current tool.
|
|
552
|
-
*
|
|
553
|
-
* @example
|
|
554
|
-
* ```typescript
|
|
555
|
-
* // Set the settings for the marker tool
|
|
556
|
-
* await felt.setToolSettings({
|
|
557
|
-
* tool: "marker",
|
|
558
|
-
* color: "#FE17",
|
|
559
|
-
* });
|
|
560
|
-
* ```
|
|
561
|
-
*
|
|
562
|
-
* @param settings - The settings to set.
|
|
563
|
-
*/
|
|
564
|
-
setToolSettings(settings: InputToolSettings): void;
|
|
565
|
-
/**
|
|
566
|
-
* Gets the settings for the chosen tool
|
|
567
|
-
*
|
|
568
|
-
* @example
|
|
569
|
-
* ```typescript
|
|
570
|
-
* const settings = await felt.getToolSettings("marker");
|
|
571
|
-
* ```
|
|
572
|
-
*
|
|
573
|
-
* @returns The settings for the chosen tool.
|
|
574
|
-
*/
|
|
575
|
-
getToolSettings<T extends ConfigurableToolType>(tool: T): Promise<ToolSettingsMap[T]>;
|
|
576
|
-
/**
|
|
577
|
-
* Listens for changes to the settings on all tools.
|
|
578
|
-
*
|
|
579
|
-
* @example
|
|
580
|
-
* ```typescript
|
|
581
|
-
* const unsubscribe = felt.onToolSettingsChange({
|
|
582
|
-
* handler: settings => console.log(settings),
|
|
583
|
-
* });
|
|
584
|
-
*
|
|
585
|
-
* // later on...
|
|
586
|
-
* unsubscribe();
|
|
587
|
-
* ```
|
|
588
|
-
* @returns A function to unsubscribe from the listener
|
|
589
|
-
*/
|
|
590
|
-
onToolSettingsChange(args: {
|
|
591
|
-
handler: (settings: ToolSettingsChangeEvent) => void;
|
|
592
|
-
}): VoidFunction;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
/**
|
|
596
|
-
* @public
|
|
597
|
-
*/
|
|
598
|
-
interface UiControlsOptions extends zInfer<typeof UiControlsOptionsSchema> {
|
|
599
|
-
}
|
|
600
|
-
/**
|
|
601
|
-
* @internal
|
|
602
|
-
* @ignore
|
|
603
|
-
*/
|
|
604
|
-
declare const UiControlsOptionsSchema: z.ZodObject<{
|
|
605
|
-
/**
|
|
606
|
-
* Whether or not the legend is shown.
|
|
607
|
-
*
|
|
608
|
-
* @defaultValue true
|
|
609
|
-
*/
|
|
610
|
-
showLegend: z.ZodOptional<z.ZodBoolean>;
|
|
611
|
-
/**
|
|
612
|
-
* When co-operative gestures are enabled, the pan and zoom gestures are
|
|
613
|
-
* adjusted to work better when the map is embedded in another page.
|
|
614
|
-
*
|
|
615
|
-
* @remarks
|
|
616
|
-
* On mobile devices, enabling co-operative gestures will allow the user to
|
|
617
|
-
* pan past the embedded map with a single finger drag. To pan the map, they
|
|
618
|
-
* must use two fingers.
|
|
619
|
-
*
|
|
620
|
-
* On desktop devices, enabling co-operative gestures allows the user to
|
|
621
|
-
* scroll past the embedded map using their scroll wheel or trackpad. To
|
|
622
|
-
* zoom the map, they must hold the Ctrl (Windows) or Command key (Mac) while
|
|
623
|
-
* scrolling.
|
|
624
|
-
*
|
|
625
|
-
* @defaultValue true
|
|
626
|
-
*/
|
|
627
|
-
cooperativeGestures: z.ZodOptional<z.ZodBoolean>;
|
|
628
|
-
/**
|
|
629
|
-
* Whether or not the full screen button is shown in an embedded map.
|
|
630
|
-
*
|
|
631
|
-
* @remarks
|
|
632
|
-
* When clicked, this will open the map in a new tab or window.
|
|
633
|
-
*
|
|
634
|
-
* @defaultValue true
|
|
635
|
-
*/
|
|
636
|
-
fullScreenButton: z.ZodOptional<z.ZodBoolean>;
|
|
637
|
-
/**
|
|
638
|
-
* Whether or not the geolocation button is shown in an embedded map.
|
|
639
|
-
*
|
|
640
|
-
* @remarks
|
|
641
|
-
* The geolocation feature will plot your position on the map. If you
|
|
642
|
-
* click the button again, it will start tracking your position.
|
|
643
|
-
*
|
|
644
|
-
* @defaultValue false
|
|
645
|
-
*/
|
|
646
|
-
geolocation: z.ZodOptional<z.ZodBoolean>;
|
|
647
|
-
/**
|
|
648
|
-
* Whether or not the zoom controls are shown in an embedded map.
|
|
649
|
-
*
|
|
650
|
-
* @remarks
|
|
651
|
-
* This does not affect whether or not the map can be zoomed, just
|
|
652
|
-
* the display of the zoom controls in the bottom right corner of the map.
|
|
653
|
-
*
|
|
654
|
-
* @defaultValue true
|
|
655
|
-
*/
|
|
656
|
-
zoomControls: z.ZodOptional<z.ZodBoolean>;
|
|
657
|
-
/**
|
|
658
|
-
* Whether or not the scale bar is shown in an embedded map.
|
|
659
|
-
*
|
|
660
|
-
* @defaultValue true
|
|
661
|
-
*/
|
|
662
|
-
scaleBar: z.ZodOptional<z.ZodBoolean>;
|
|
663
|
-
}, "strip", z.ZodTypeAny, {
|
|
664
|
-
showLegend?: boolean | undefined;
|
|
665
|
-
cooperativeGestures?: boolean | undefined;
|
|
666
|
-
fullScreenButton?: boolean | undefined;
|
|
667
|
-
geolocation?: boolean | undefined;
|
|
668
|
-
zoomControls?: boolean | undefined;
|
|
669
|
-
scaleBar?: boolean | undefined;
|
|
670
|
-
}, {
|
|
671
|
-
showLegend?: boolean | undefined;
|
|
672
|
-
cooperativeGestures?: boolean | undefined;
|
|
673
|
-
fullScreenButton?: boolean | undefined;
|
|
674
|
-
geolocation?: boolean | undefined;
|
|
675
|
-
zoomControls?: boolean | undefined;
|
|
676
|
-
scaleBar?: boolean | undefined;
|
|
677
|
-
}>;
|
|
678
|
-
/**
|
|
679
|
-
* The options for which parts of the Felt UI can be shown when interacting with
|
|
680
|
-
* features and elements on the map.
|
|
681
|
-
*
|
|
682
|
-
* Switching these off can be useful if you add your own click, selection or hover
|
|
683
|
-
* handlers for features and elements.
|
|
684
|
-
*
|
|
685
|
-
* @public
|
|
686
|
-
*/
|
|
687
|
-
interface UiOnMapInteractionsOptions extends zInfer<typeof UiOnMapInteractionsOptionsSchema> {
|
|
688
|
-
}
|
|
689
|
-
/**
|
|
690
|
-
* @internal
|
|
691
|
-
* @ignore
|
|
692
|
-
*/
|
|
693
|
-
declare const UiOnMapInteractionsOptionsSchema: z.ZodObject<{
|
|
694
|
-
/**
|
|
695
|
-
* Set this to `false` to prevent the panel that shows information about a selected
|
|
696
|
-
* feature from being shown.
|
|
697
|
-
*/
|
|
698
|
-
featureSelectPanel: z.ZodOptional<z.ZodBoolean>;
|
|
699
|
-
/**
|
|
700
|
-
* Set this to `false` to prevent the panel that shows information about a hovered
|
|
701
|
-
* feature from being shown.
|
|
702
|
-
*/
|
|
703
|
-
featureHoverPanel: z.ZodOptional<z.ZodBoolean>;
|
|
704
|
-
/**
|
|
705
|
-
* Set this to `false` to prevent the panel that shows information about a selected
|
|
706
|
-
* element from being shown.
|
|
707
|
-
*/
|
|
708
|
-
elementSelectPanel: z.ZodOptional<z.ZodBoolean>;
|
|
709
|
-
/**
|
|
710
|
-
* Set this to `false` to prevent clicking on a map link element from opening that link
|
|
711
|
-
* in a new tab or window.
|
|
712
|
-
*/
|
|
713
|
-
linkClickOpen: z.ZodOptional<z.ZodBoolean>;
|
|
714
|
-
/**
|
|
715
|
-
* Set this to `false` to prevent clicking on an image element from opening the image
|
|
716
|
-
* in a lightbox.
|
|
717
|
-
*/
|
|
718
|
-
imageLightboxOpen: z.ZodOptional<z.ZodBoolean>;
|
|
719
|
-
}, "strip", z.ZodTypeAny, {
|
|
720
|
-
featureSelectPanel?: boolean | undefined;
|
|
721
|
-
featureHoverPanel?: boolean | undefined;
|
|
722
|
-
elementSelectPanel?: boolean | undefined;
|
|
723
|
-
linkClickOpen?: boolean | undefined;
|
|
724
|
-
imageLightboxOpen?: boolean | undefined;
|
|
725
|
-
}, {
|
|
726
|
-
featureSelectPanel?: boolean | undefined;
|
|
727
|
-
featureHoverPanel?: boolean | undefined;
|
|
728
|
-
elementSelectPanel?: boolean | undefined;
|
|
729
|
-
linkClickOpen?: boolean | undefined;
|
|
730
|
-
imageLightboxOpen?: boolean | undefined;
|
|
731
|
-
}>;
|
|
732
|
-
|
|
733
|
-
/**
|
|
734
|
-
* The UI controller allows you to control various aspects of the Felt UI in your embedded map.
|
|
735
|
-
*
|
|
736
|
-
* This includes enabling/disabling UI controls, managing on-map interactions, and controlling
|
|
737
|
-
* the visibility of UI components like the data table.
|
|
738
|
-
*
|
|
739
|
-
* @group Controller
|
|
740
|
-
* @public
|
|
741
|
-
*/
|
|
742
|
-
interface UiController {
|
|
743
|
-
/**
|
|
744
|
-
* Updates the UI controls on the embedded map.
|
|
745
|
-
*
|
|
746
|
-
* @example
|
|
747
|
-
* ```typescript
|
|
748
|
-
* // Show some UI controls
|
|
749
|
-
* await felt.updateUiControls({
|
|
750
|
-
* showLegend: true,
|
|
751
|
-
* fullScreenButton: true,
|
|
752
|
-
* });
|
|
753
|
-
*
|
|
754
|
-
* // Disable some UI options
|
|
755
|
-
* await felt.updateUiControls({
|
|
756
|
-
* cooperativeGestures: false,
|
|
757
|
-
* geolocation: false,
|
|
758
|
-
* });
|
|
759
|
-
* ```
|
|
760
|
-
*
|
|
761
|
-
* @param controls - The controls to update.
|
|
762
|
-
*/
|
|
763
|
-
updateUiControls(controls: UiControlsOptions): void;
|
|
764
|
-
/**
|
|
765
|
-
* Control the on-map UI shown when interacting with features and elements.
|
|
766
|
-
*
|
|
767
|
-
* If you add your own click, selection or hover handlers you may want to disable
|
|
768
|
-
* various parts of the Felt UI. This method allows you to control the visibility of
|
|
769
|
-
* various parts of the UI that might otherwise be shown when people click or hover
|
|
770
|
-
* on things.
|
|
771
|
-
*
|
|
772
|
-
* This does not affect selection. That means that selectable features and elements
|
|
773
|
-
* will still be selected when clicked.
|
|
774
|
-
*
|
|
775
|
-
* @example
|
|
776
|
-
* ```typescript
|
|
777
|
-
* // Disable UI when hovering or selecting features
|
|
778
|
-
* await felt.setOnMapInteractionsUi({
|
|
779
|
-
* featureSelectPanel: false,
|
|
780
|
-
* featureHoverPanel: false,
|
|
781
|
-
* });
|
|
782
|
-
* ```
|
|
783
|
-
*/
|
|
784
|
-
setOnMapInteractionsUi(options: UiOnMapInteractionsOptions): void;
|
|
785
|
-
/**
|
|
786
|
-
* Shows a data table view for the specified layer, optionally sorted by a given attribute.
|
|
787
|
-
*
|
|
788
|
-
* @example
|
|
789
|
-
* ```typescript
|
|
790
|
-
* // Show data table with default sorting
|
|
791
|
-
* await felt.showLayerDataTable({
|
|
792
|
-
* layerId: "layer-1",
|
|
793
|
-
* });
|
|
794
|
-
*
|
|
795
|
-
* // Show data table sorted by height in descending order
|
|
796
|
-
* await felt.showLayerDataTable({
|
|
797
|
-
* layerId: "layer-1",
|
|
798
|
-
* sorting: {
|
|
799
|
-
* attribute: "height",
|
|
800
|
-
* direction: "desc",
|
|
801
|
-
* },
|
|
802
|
-
* });
|
|
803
|
-
*
|
|
804
|
-
* // Show the data table pane with no table visible
|
|
805
|
-
* await felt.showLayerDataTable();
|
|
806
|
-
* ```
|
|
807
|
-
*/
|
|
808
|
-
showLayerDataTable(params?: {
|
|
809
|
-
layerId: string;
|
|
810
|
-
sorting?: SortConfig;
|
|
811
|
-
}): Promise<void>;
|
|
812
|
-
/**
|
|
813
|
-
* Hides the data table.
|
|
814
|
-
*
|
|
815
|
-
* @example
|
|
816
|
-
* ```typescript
|
|
817
|
-
* await felt.hideLayerDataTable();
|
|
818
|
-
* ```
|
|
819
|
-
*/
|
|
820
|
-
hideLayerDataTable(): Promise<void>;
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
/**
|
|
824
|
-
* The viewport controller allows you to control the viewport of the map.
|
|
825
|
-
*
|
|
826
|
-
* You can get the current viewport, move the viewport, and be notified when
|
|
827
|
-
* the viewport changes.
|
|
828
|
-
*
|
|
829
|
-
* @group Controller
|
|
830
|
-
* @public
|
|
831
|
-
*/
|
|
832
|
-
interface ViewportController {
|
|
833
|
-
/**
|
|
834
|
-
* Gets the current state of the viewport.
|
|
835
|
-
*
|
|
836
|
-
* @example
|
|
837
|
-
* ```typescript
|
|
838
|
-
* // Get current viewport state
|
|
839
|
-
* const viewport = await felt.getViewport();
|
|
840
|
-
* console.log({
|
|
841
|
-
* center: viewport.center,
|
|
842
|
-
* zoom: viewport.zoom,
|
|
843
|
-
* });
|
|
844
|
-
* ```
|
|
845
|
-
*/
|
|
846
|
-
getViewport(): Promise<ViewportState>;
|
|
847
|
-
/**
|
|
848
|
-
* Moves the map to the specified location.
|
|
849
|
-
*
|
|
850
|
-
* @example
|
|
851
|
-
* ```typescript
|
|
852
|
-
* felt.setViewport({
|
|
853
|
-
* center: { latitude: 0, longitude: 0 },
|
|
854
|
-
* zoom: 10,
|
|
855
|
-
* });
|
|
856
|
-
* ```
|
|
857
|
-
*/
|
|
858
|
-
setViewport(viewport: SetViewportCenterZoomParams): void;
|
|
859
|
-
/**
|
|
860
|
-
* Gets the current state of the viewport constraints.
|
|
861
|
-
*
|
|
862
|
-
* @example
|
|
863
|
-
* ```typescript
|
|
864
|
-
* // Get current viewport constraints
|
|
865
|
-
* const constraints = await felt.getViewportConstraints();
|
|
866
|
-
* if (constraints) {
|
|
867
|
-
* console.log({
|
|
868
|
-
* bounds: constraints.bounds,
|
|
869
|
-
* minZoom: constraints.minZoom,
|
|
870
|
-
* maxZoom: constraints.maxZoom
|
|
871
|
-
* });
|
|
872
|
-
* } else {
|
|
873
|
-
* console.log("No viewport constraints set");
|
|
874
|
-
* }
|
|
875
|
-
* ```
|
|
876
|
-
*/
|
|
877
|
-
getViewportConstraints(): Promise<ViewportConstraints | null>;
|
|
878
|
-
/**
|
|
879
|
-
* Constrains the map viewport so it stays inside certain bounds and/or certain zoom levels.
|
|
880
|
-
*
|
|
881
|
-
* @example
|
|
882
|
-
* ```typescript
|
|
883
|
-
* felt.setViewportConstraints({
|
|
884
|
-
* bounds: [-122.5372532, 37.6652478, -122.1927016, 37.881707],
|
|
885
|
-
* minZoom: 1,
|
|
886
|
-
* maxZoom: 23,
|
|
887
|
-
* });
|
|
888
|
-
* ```
|
|
889
|
-
*
|
|
890
|
-
* @example
|
|
891
|
-
* every constraint is optional
|
|
892
|
-
* ```typescript
|
|
893
|
-
* felt.setViewportConstraints({
|
|
894
|
-
* bounds: [-122.5372532, 37.6652478, -122.1927016, 37.881707],
|
|
895
|
-
* });
|
|
896
|
-
* ```
|
|
897
|
-
*
|
|
898
|
-
* @example
|
|
899
|
-
* if a constraint is null, it will be removed but keeping the others
|
|
900
|
-
* ```typescript
|
|
901
|
-
* felt.setViewportConstraints({ bounds: null });
|
|
902
|
-
* ```
|
|
903
|
-
*
|
|
904
|
-
* @example
|
|
905
|
-
* if method receives null, it will remove the constraints
|
|
906
|
-
* ```typescript
|
|
907
|
-
* felt.setViewportConstraints(null);
|
|
908
|
-
* ```
|
|
909
|
-
*/
|
|
910
|
-
setViewportConstraints(constraints: Partial<ViewportConstraints> | null): void;
|
|
911
|
-
/**
|
|
912
|
-
* Fits the map to the specified bounds.
|
|
913
|
-
*
|
|
914
|
-
* @example
|
|
915
|
-
* ```typescript
|
|
916
|
-
* const west = -122.4194;
|
|
917
|
-
* const south = 37.7749;
|
|
918
|
-
* const east = -122.4194;
|
|
919
|
-
* const north = 37.7749;
|
|
920
|
-
* felt.fitViewportToBounds({ bounds: [west, south, east, north] });
|
|
921
|
-
* ```
|
|
922
|
-
*/
|
|
923
|
-
fitViewportToBounds(bounds: ViewportFitBoundsParams): void;
|
|
924
|
-
/**
|
|
925
|
-
* Adds a listener for when the viewport changes.
|
|
926
|
-
*
|
|
927
|
-
* @returns A function to unsubscribe from the listener
|
|
928
|
-
*
|
|
929
|
-
* @event
|
|
930
|
-
* @example
|
|
931
|
-
* ```typescript
|
|
932
|
-
* const unsubscribe = felt.onViewportMove({
|
|
933
|
-
* handler: viewport => console.log(viewport.center.latitude),
|
|
934
|
-
* });
|
|
935
|
-
*
|
|
936
|
-
* // later on...
|
|
937
|
-
* unsubscribe();
|
|
938
|
-
* ```
|
|
939
|
-
*/
|
|
940
|
-
onViewportMove(args: {
|
|
941
|
-
/**
|
|
942
|
-
* This callback is called with the current viewport state whenever
|
|
943
|
-
* the viewport changes.
|
|
944
|
-
*
|
|
945
|
-
* @param viewport - The current viewport state.
|
|
946
|
-
*/
|
|
947
|
-
handler: (viewport: ViewportState) => void;
|
|
948
|
-
}): VoidFunction;
|
|
949
|
-
/**
|
|
950
|
-
* Adds a listener for when the viewport move ends, which is when the user
|
|
951
|
-
* stops dragging or zooming the map, animations have finished, or inertial
|
|
952
|
-
* dragging ends.
|
|
953
|
-
*
|
|
954
|
-
* @returns A function to unsubscribe from the listener
|
|
955
|
-
*
|
|
956
|
-
* @event
|
|
957
|
-
* @example
|
|
958
|
-
* ```typescript
|
|
959
|
-
* const unsubscribe = felt.onViewportMoveEnd({
|
|
960
|
-
* handler: viewport => console.log(viewport.center.latitude),
|
|
961
|
-
* });
|
|
962
|
-
*
|
|
963
|
-
* // later on...
|
|
964
|
-
* unsubscribe();
|
|
965
|
-
* ```
|
|
966
|
-
*/
|
|
967
|
-
onViewportMoveEnd(args: {
|
|
968
|
-
handler: (viewport: ViewportState) => void;
|
|
969
|
-
}): VoidFunction;
|
|
970
|
-
/**
|
|
971
|
-
* Adds a listener for when the map is idle, which is defined as:
|
|
972
|
-
* - No transitions are in progress
|
|
973
|
-
* - The user is not interacting with the map, e.g. by panning or zooming
|
|
974
|
-
* - All tiles for the current viewport have been loaded
|
|
975
|
-
* - Any fade transitions (e.g. for labels) have completed
|
|
976
|
-
*
|
|
977
|
-
* @returns A function to unsubscribe from the listener
|
|
978
|
-
*
|
|
979
|
-
* @event
|
|
980
|
-
* @example
|
|
981
|
-
* ```typescript
|
|
982
|
-
* const unsubscribe = felt.onMapIdle({ handler: () => console.log("map is idle") });
|
|
983
|
-
*
|
|
984
|
-
* // later on...
|
|
985
|
-
* unsubscribe();
|
|
986
|
-
* ```
|
|
987
|
-
*/
|
|
988
|
-
onMapIdle(args: {
|
|
989
|
-
handler: () => void;
|
|
990
|
-
}): VoidFunction;
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
/**
|
|
994
|
-
* This is the main interface for interacting with a Felt map.
|
|
995
|
-
*
|
|
996
|
-
* This interface is composed of the various controllers, each having a
|
|
997
|
-
* different area of responsibility.
|
|
998
|
-
*
|
|
999
|
-
* All the methods are listed here, but each controller is documented on its
|
|
1000
|
-
* own to make it easier to find related methods and events.
|
|
1001
|
-
*
|
|
1002
|
-
* @group Controller
|
|
1003
|
-
* @public
|
|
1004
|
-
*/
|
|
1005
|
-
interface FeltController extends ViewportController, UiController, LayersController, ElementsController, SelectionController, InteractionsController, ToolsController, InteractionsController, MiscController {
|
|
1006
|
-
/**
|
|
1007
|
-
* The iframe element containing the Felt map, if it is an embedded map.
|
|
1008
|
-
*
|
|
1009
|
-
* @readonly
|
|
1010
|
-
*/
|
|
1011
|
-
iframe: HTMLIFrameElement | null;
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
5
|
/**
|
|
1015
6
|
* @group Instantiation
|
|
1016
7
|
* @public
|
|
@@ -1174,4 +165,4 @@ declare const Felt: {
|
|
|
1174
165
|
connect(feltWindow: Pick<Window, "postMessage">): Promise<FeltController>;
|
|
1175
166
|
};
|
|
1176
167
|
|
|
1177
|
-
export {
|
|
168
|
+
export { Felt, FeltController, type FeltEmbedOptions, UiControlsOptions, ViewportCenterZoom };
|