@remotion/maptiler 4.0.527 → 4.0.528
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/MapHeatmap.d.ts +2 -2
- package/dist/MapLayer.d.ts +3 -2
- package/dist/MapOverlay.d.ts +4 -4
- package/dist/MapPoint.d.ts +2 -2
- package/dist/MapPolygon.d.ts +2 -2
- package/dist/MapPolyline.d.ts +2 -2
- package/dist/MapRegion.d.ts +2 -2
- package/dist/MapRoute.d.ts +2 -2
- package/dist/MapSource.d.ts +3 -2
- package/dist/MapViewport.d.ts +3 -3
- package/dist/esm/index.mjs +748 -267
- package/dist/use-map-premounting.d.ts +1 -0
- package/package.json +3 -3
package/dist/esm/index.mjs
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
import {
|
|
3
3
|
helpers
|
|
4
4
|
} from "@maptiler/sdk";
|
|
5
|
-
import { useContext as
|
|
5
|
+
import { useContext as useContext3, useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
6
6
|
import {
|
|
7
|
+
Freeze,
|
|
7
8
|
Sequence,
|
|
9
|
+
Internals as Internals2,
|
|
8
10
|
useDelayRender
|
|
9
11
|
} from "remotion";
|
|
10
12
|
|
|
@@ -43,6 +45,37 @@ var useMapTiler = () => {
|
|
|
43
45
|
return useContext(MapTilerContext);
|
|
44
46
|
};
|
|
45
47
|
|
|
48
|
+
// src/use-map-premounting.ts
|
|
49
|
+
import { useCallback, useContext as useContext2, useEffect, useRef } from "react";
|
|
50
|
+
import { Internals } from "remotion";
|
|
51
|
+
var useMapPremounting = (getLayerIds) => {
|
|
52
|
+
const { map } = useContext2(MapTilerContext);
|
|
53
|
+
const sequence = useContext2(Internals.SequenceContext);
|
|
54
|
+
const hidden = Boolean(sequence?.premounting || sequence?.postmounting);
|
|
55
|
+
const hiddenRef = useRef(hidden);
|
|
56
|
+
const layerIdsRef = useRef(getLayerIds);
|
|
57
|
+
hiddenRef.current = hidden;
|
|
58
|
+
layerIdsRef.current = getLayerIds;
|
|
59
|
+
const applyPremountVisibility = useCallback(() => {
|
|
60
|
+
if (!map) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
for (const id of layerIdsRef.current()) {
|
|
64
|
+
if (!id || !map.getLayer(id)) {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const visibility = hiddenRef.current ? "none" : "visible";
|
|
68
|
+
if (map.getLayoutProperty(id, "visibility") !== visibility) {
|
|
69
|
+
map.setLayoutProperty(id, "visibility", visibility);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}, [map]);
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
applyPremountVisibility();
|
|
75
|
+
}, [applyPremountVisibility, hidden]);
|
|
76
|
+
return applyPremountVisibility;
|
|
77
|
+
};
|
|
78
|
+
|
|
46
79
|
// src/MapHeatmap.tsx
|
|
47
80
|
import { jsx } from "react/jsx-runtime";
|
|
48
81
|
var MapHeatmapDrawing = ({
|
|
@@ -60,10 +93,11 @@ var MapHeatmapDrawing = ({
|
|
|
60
93
|
weight,
|
|
61
94
|
zoomCompensation
|
|
62
95
|
}) => {
|
|
63
|
-
const { map, styleRevision } =
|
|
96
|
+
const { map, styleRevision } = useContext3(MapTilerContext);
|
|
64
97
|
const { continueRender, delayRender } = useDelayRender();
|
|
65
|
-
const layerIdsRef =
|
|
66
|
-
const
|
|
98
|
+
const layerIdsRef = useRef2(null);
|
|
99
|
+
const applyPremountVisibility = useMapPremounting(() => Object.entries(layerIdsRef.current ?? {}).filter(([key]) => key.endsWith("LayerId")).map(([, value]) => value));
|
|
100
|
+
const optionsRef = useRef2(null);
|
|
67
101
|
const intensityIsDynamic = typeof intensity === "number";
|
|
68
102
|
const opacityIsDynamic = typeof opacity === "number";
|
|
69
103
|
const radiusIsDynamic = typeof radius === "number";
|
|
@@ -95,7 +129,7 @@ var MapHeatmapDrawing = ({
|
|
|
95
129
|
...weight === undefined ? {} : { weight },
|
|
96
130
|
...zoomCompensation === undefined ? {} : { zoomCompensation }
|
|
97
131
|
};
|
|
98
|
-
|
|
132
|
+
useEffect2(() => {
|
|
99
133
|
if (!map || !optionsRef.current) {
|
|
100
134
|
return;
|
|
101
135
|
}
|
|
@@ -109,6 +143,7 @@ var MapHeatmapDrawing = ({
|
|
|
109
143
|
continueRender(loadingHandle);
|
|
110
144
|
};
|
|
111
145
|
layerIdsRef.current = helpers.addHeatmap(map, optionsRef.current);
|
|
146
|
+
applyPremountVisibility();
|
|
112
147
|
map.once("idle", finish);
|
|
113
148
|
map.triggerRepaint();
|
|
114
149
|
return () => {
|
|
@@ -127,8 +162,16 @@ var MapHeatmapDrawing = ({
|
|
|
127
162
|
layerIdsRef.current = null;
|
|
128
163
|
map.triggerRepaint();
|
|
129
164
|
};
|
|
130
|
-
}, [
|
|
131
|
-
|
|
165
|
+
}, [
|
|
166
|
+
applyPremountVisibility,
|
|
167
|
+
continueRender,
|
|
168
|
+
delayRender,
|
|
169
|
+
layerId,
|
|
170
|
+
map,
|
|
171
|
+
structuralKey,
|
|
172
|
+
styleRevision
|
|
173
|
+
]);
|
|
174
|
+
useEffect2(() => {
|
|
132
175
|
if (!map || typeof data === "string") {
|
|
133
176
|
return;
|
|
134
177
|
}
|
|
@@ -143,7 +186,7 @@ var MapHeatmapDrawing = ({
|
|
|
143
186
|
});
|
|
144
187
|
}
|
|
145
188
|
}, [continueRender, data, delayRender, layerId, map]);
|
|
146
|
-
|
|
189
|
+
useEffect2(() => {
|
|
147
190
|
if (!map) {
|
|
148
191
|
return;
|
|
149
192
|
}
|
|
@@ -188,34 +231,75 @@ var MapHeatmap = (props) => {
|
|
|
188
231
|
durationInFrames,
|
|
189
232
|
freeze,
|
|
190
233
|
from,
|
|
234
|
+
premountFor,
|
|
235
|
+
postmountFor,
|
|
191
236
|
hidden,
|
|
192
237
|
name,
|
|
193
238
|
showInTimeline,
|
|
194
|
-
trimBefore
|
|
239
|
+
trimBefore,
|
|
240
|
+
playbackRate
|
|
195
241
|
} = props;
|
|
196
|
-
|
|
197
|
-
|
|
242
|
+
const {
|
|
243
|
+
effectivePremountFor,
|
|
244
|
+
effectivePostmountFor,
|
|
245
|
+
freezeFrame,
|
|
246
|
+
isPremountingOrPostmounting,
|
|
247
|
+
premountingActive,
|
|
248
|
+
postmountingActive
|
|
249
|
+
} = Internals2.usePremounting({
|
|
198
250
|
from: from ?? 0,
|
|
199
|
-
trimBefore,
|
|
200
251
|
durationInFrames: durationInFrames ?? Infinity,
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
252
|
+
premountFor: premountFor ?? null,
|
|
253
|
+
postmountFor: postmountFor ?? null,
|
|
254
|
+
style: null,
|
|
255
|
+
styleWhilePremounted: null,
|
|
256
|
+
styleWhilePostmounted: null,
|
|
257
|
+
hideWhilePremounted: "opacity"
|
|
258
|
+
});
|
|
259
|
+
return /* @__PURE__ */ jsx(Freeze, {
|
|
260
|
+
frame: freezeFrame,
|
|
261
|
+
active: isPremountingOrPostmounting,
|
|
262
|
+
children: /* @__PURE__ */ jsx(Sequence, {
|
|
263
|
+
layout: "none",
|
|
264
|
+
from: from ?? 0,
|
|
265
|
+
trimBefore,
|
|
266
|
+
playbackRate,
|
|
267
|
+
durationInFrames: durationInFrames ?? Infinity,
|
|
268
|
+
freeze,
|
|
269
|
+
hidden,
|
|
270
|
+
name: name ?? "<MapHeatmap>",
|
|
271
|
+
showInTimeline: showInTimeline ?? true,
|
|
272
|
+
controls,
|
|
273
|
+
_remotionInternalPremountDisplay: effectivePremountFor || null,
|
|
274
|
+
_remotionInternalPostmountDisplay: effectivePostmountFor || null,
|
|
275
|
+
_remotionInternalIsPremounting: premountingActive,
|
|
276
|
+
_remotionInternalIsPostmounting: postmountingActive,
|
|
277
|
+
children: /* @__PURE__ */ jsx(MapHeatmapDrawing, {
|
|
278
|
+
...props
|
|
279
|
+
})
|
|
208
280
|
})
|
|
209
281
|
});
|
|
210
282
|
};
|
|
211
283
|
// src/MapLayer.tsx
|
|
212
|
-
import { useContext as
|
|
213
|
-
import {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
284
|
+
import { useContext as useContext4, useEffect as useEffect3, useRef as useRef3, useMemo } from "react";
|
|
285
|
+
import {
|
|
286
|
+
Freeze as Freeze2,
|
|
287
|
+
Sequence as Sequence2,
|
|
288
|
+
Internals as Internals3,
|
|
289
|
+
useDelayRender as useDelayRender2
|
|
290
|
+
} from "remotion";
|
|
291
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
292
|
+
var MapLayerContent = ({ beforeId, layer: passedLayer }) => {
|
|
293
|
+
const { map, styleRevision } = useContext4(MapTilerContext);
|
|
294
|
+
const sequence = useContext4(Internals3.SequenceContext);
|
|
295
|
+
const isPremountingOrPostmounting = Boolean(sequence?.premounting || sequence?.postmounting);
|
|
296
|
+
const layer = useMemo(() => isPremountingOrPostmounting ? {
|
|
297
|
+
...passedLayer,
|
|
298
|
+
layout: { ...passedLayer.layout, visibility: "none" }
|
|
299
|
+
} : passedLayer, [isPremountingOrPostmounting, passedLayer]);
|
|
300
|
+
const previousLayerRef = useRef3(null);
|
|
217
301
|
const { continueRender, delayRender } = useDelayRender2();
|
|
218
|
-
|
|
302
|
+
useEffect3(() => {
|
|
219
303
|
if (!map) {
|
|
220
304
|
return;
|
|
221
305
|
}
|
|
@@ -274,7 +358,7 @@ var MapLayer = ({ beforeId, layer }) => {
|
|
|
274
358
|
finish();
|
|
275
359
|
};
|
|
276
360
|
}, [beforeId, continueRender, delayRender, layer, map, styleRevision]);
|
|
277
|
-
|
|
361
|
+
useEffect3(() => {
|
|
278
362
|
if (!map) {
|
|
279
363
|
return;
|
|
280
364
|
}
|
|
@@ -287,20 +371,76 @@ var MapLayer = ({ beforeId, layer }) => {
|
|
|
287
371
|
}, [layer.id, map]);
|
|
288
372
|
return null;
|
|
289
373
|
};
|
|
374
|
+
var MapLayer = ({
|
|
375
|
+
from,
|
|
376
|
+
durationInFrames,
|
|
377
|
+
trimBefore,
|
|
378
|
+
playbackRate,
|
|
379
|
+
freeze,
|
|
380
|
+
hidden,
|
|
381
|
+
name,
|
|
382
|
+
showInTimeline,
|
|
383
|
+
premountFor,
|
|
384
|
+
postmountFor,
|
|
385
|
+
...props
|
|
386
|
+
}) => {
|
|
387
|
+
const {
|
|
388
|
+
effectivePremountFor,
|
|
389
|
+
effectivePostmountFor,
|
|
390
|
+
freezeFrame,
|
|
391
|
+
isPremountingOrPostmounting,
|
|
392
|
+
premountingActive,
|
|
393
|
+
postmountingActive
|
|
394
|
+
} = Internals3.usePremounting({
|
|
395
|
+
from: from ?? 0,
|
|
396
|
+
durationInFrames: durationInFrames ?? Infinity,
|
|
397
|
+
premountFor: premountFor ?? null,
|
|
398
|
+
postmountFor: postmountFor ?? null,
|
|
399
|
+
style: null,
|
|
400
|
+
styleWhilePremounted: null,
|
|
401
|
+
styleWhilePostmounted: null,
|
|
402
|
+
hideWhilePremounted: "opacity"
|
|
403
|
+
});
|
|
404
|
+
return /* @__PURE__ */ jsx2(Freeze2, {
|
|
405
|
+
frame: freezeFrame,
|
|
406
|
+
active: isPremountingOrPostmounting,
|
|
407
|
+
children: /* @__PURE__ */ jsx2(Sequence2, {
|
|
408
|
+
layout: "none",
|
|
409
|
+
from,
|
|
410
|
+
durationInFrames,
|
|
411
|
+
trimBefore,
|
|
412
|
+
playbackRate,
|
|
413
|
+
freeze,
|
|
414
|
+
hidden,
|
|
415
|
+
showInTimeline: showInTimeline ?? false,
|
|
416
|
+
name: name ?? "<MapLayer>",
|
|
417
|
+
_remotionInternalPremountDisplay: effectivePremountFor || null,
|
|
418
|
+
_remotionInternalPostmountDisplay: effectivePostmountFor || null,
|
|
419
|
+
_remotionInternalIsPremounting: premountingActive,
|
|
420
|
+
_remotionInternalIsPostmounting: postmountingActive,
|
|
421
|
+
children: /* @__PURE__ */ jsx2(MapLayerContent, {
|
|
422
|
+
...props
|
|
423
|
+
})
|
|
424
|
+
})
|
|
425
|
+
});
|
|
426
|
+
};
|
|
290
427
|
// src/MapOverlay.tsx
|
|
291
428
|
import {
|
|
292
429
|
forwardRef,
|
|
293
|
-
useContext as
|
|
430
|
+
useContext as useContext5,
|
|
294
431
|
useImperativeHandle,
|
|
295
|
-
useRef as
|
|
432
|
+
useRef as useRef4
|
|
296
433
|
} from "react";
|
|
297
434
|
import {
|
|
298
435
|
Interactive,
|
|
299
|
-
|
|
436
|
+
Freeze as Freeze3,
|
|
437
|
+
Sequence as Sequence3,
|
|
438
|
+
Internals as Internals4
|
|
300
439
|
} from "remotion";
|
|
301
|
-
import { jsx as
|
|
440
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
302
441
|
var mapOverlaySchema = {
|
|
303
442
|
...Interactive.baseSchema,
|
|
443
|
+
...Interactive.premountSchema,
|
|
304
444
|
longitude: {
|
|
305
445
|
type: "number",
|
|
306
446
|
min: -180,
|
|
@@ -374,44 +514,76 @@ var MapOverlayRefForwardingFunction = ({
|
|
|
374
514
|
style,
|
|
375
515
|
durationInFrames,
|
|
376
516
|
from,
|
|
517
|
+
premountFor,
|
|
518
|
+
postmountFor,
|
|
519
|
+
styleWhilePremounted,
|
|
520
|
+
styleWhilePostmounted,
|
|
377
521
|
trimBefore,
|
|
522
|
+
playbackRate,
|
|
378
523
|
freeze,
|
|
379
524
|
hidden,
|
|
380
525
|
name,
|
|
381
526
|
showInTimeline,
|
|
382
527
|
controls
|
|
383
528
|
}, ref) => {
|
|
384
|
-
const { map } =
|
|
385
|
-
const refForOutline =
|
|
529
|
+
const { map } = useContext5(MapTilerContext);
|
|
530
|
+
const refForOutline = useRef4(null);
|
|
386
531
|
const point = map?.project([longitude, latitude]);
|
|
387
532
|
const horizontalAnchor = anchor.includes("left") ? 0 : anchor.includes("right") ? -100 : -50;
|
|
388
533
|
const verticalAnchor = anchor.includes("top") ? 0 : anchor.includes("bottom") ? -100 : -50;
|
|
389
534
|
useImperativeHandle(ref, () => refForOutline.current, []);
|
|
390
|
-
|
|
391
|
-
|
|
535
|
+
const {
|
|
536
|
+
effectivePremountFor,
|
|
537
|
+
effectivePostmountFor,
|
|
538
|
+
freezeFrame,
|
|
539
|
+
isPremountingOrPostmounting,
|
|
540
|
+
premountingActive,
|
|
541
|
+
postmountingActive,
|
|
542
|
+
premountingStyle
|
|
543
|
+
} = Internals4.usePremounting({
|
|
392
544
|
from: from ?? 0,
|
|
393
|
-
trimBefore,
|
|
394
545
|
durationInFrames: durationInFrames ?? Infinity,
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
546
|
+
premountFor: premountFor ?? null,
|
|
547
|
+
postmountFor: postmountFor ?? null,
|
|
548
|
+
style: { opacity, ...style },
|
|
549
|
+
styleWhilePremounted: styleWhilePremounted ?? null,
|
|
550
|
+
styleWhilePostmounted: styleWhilePostmounted ?? null,
|
|
551
|
+
hideWhilePremounted: "opacity"
|
|
552
|
+
});
|
|
553
|
+
return /* @__PURE__ */ jsx3(Freeze3, {
|
|
554
|
+
frame: freezeFrame,
|
|
555
|
+
active: isPremountingOrPostmounting,
|
|
556
|
+
children: /* @__PURE__ */ jsx3(Sequence3, {
|
|
557
|
+
layout: "none",
|
|
558
|
+
from: from ?? 0,
|
|
559
|
+
trimBefore,
|
|
560
|
+
playbackRate,
|
|
561
|
+
durationInFrames: durationInFrames ?? Infinity,
|
|
562
|
+
freeze,
|
|
563
|
+
hidden,
|
|
564
|
+
name: name ?? "<MapOverlay>",
|
|
565
|
+
showInTimeline: showInTimeline ?? true,
|
|
566
|
+
controls,
|
|
567
|
+
outlineRef: refForOutline,
|
|
568
|
+
_remotionInternalPremountDisplay: effectivePremountFor || null,
|
|
569
|
+
_remotionInternalPostmountDisplay: effectivePostmountFor || null,
|
|
570
|
+
_remotionInternalIsPremounting: premountingActive,
|
|
571
|
+
_remotionInternalIsPostmounting: postmountingActive,
|
|
572
|
+
children: /* @__PURE__ */ jsx3("div", {
|
|
573
|
+
ref: refForOutline,
|
|
574
|
+
style: {
|
|
575
|
+
left: (point?.x ?? 0) + offsetX,
|
|
576
|
+
opacity,
|
|
577
|
+
pointerEvents: "none",
|
|
578
|
+
position: "absolute",
|
|
579
|
+
rotate: `${rotation + (rotationAlignment === "map" ? map?.getBearing() ?? 0 : 0)}deg`,
|
|
580
|
+
top: (point?.y ?? 0) + offsetY,
|
|
581
|
+
translate: `${horizontalAnchor}% ${verticalAnchor}%`,
|
|
582
|
+
zIndex: 1,
|
|
583
|
+
...premountingStyle
|
|
584
|
+
},
|
|
585
|
+
children
|
|
586
|
+
})
|
|
415
587
|
})
|
|
416
588
|
});
|
|
417
589
|
};
|
|
@@ -427,12 +599,14 @@ var MapMarker = MapOverlay;
|
|
|
427
599
|
import {
|
|
428
600
|
helpers as helpers2
|
|
429
601
|
} from "@maptiler/sdk";
|
|
430
|
-
import { useContext as
|
|
602
|
+
import { useContext as useContext6, useEffect as useEffect4, useRef as useRef5 } from "react";
|
|
431
603
|
import {
|
|
432
|
-
|
|
604
|
+
Freeze as Freeze4,
|
|
605
|
+
Sequence as Sequence4,
|
|
606
|
+
Internals as Internals5,
|
|
433
607
|
useDelayRender as useDelayRender3
|
|
434
608
|
} from "remotion";
|
|
435
|
-
import { jsx as
|
|
609
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
436
610
|
var MapPointDrawing = ({
|
|
437
611
|
alignOnViewport,
|
|
438
612
|
beforeId,
|
|
@@ -457,10 +631,11 @@ var MapPointDrawing = ({
|
|
|
457
631
|
sourceId = `${layerId}-source`,
|
|
458
632
|
zoomCompensation
|
|
459
633
|
}) => {
|
|
460
|
-
const { map, styleRevision } =
|
|
634
|
+
const { map, styleRevision } = useContext6(MapTilerContext);
|
|
461
635
|
const { continueRender, delayRender } = useDelayRender3();
|
|
462
|
-
const layerIdsRef =
|
|
463
|
-
const
|
|
636
|
+
const layerIdsRef = useRef5(null);
|
|
637
|
+
const applyPremountVisibility = useMapPremounting(() => Object.entries(layerIdsRef.current ?? {}).filter(([key]) => key.endsWith("LayerId")).map(([, value]) => value));
|
|
638
|
+
const optionsRef = useRef5(null);
|
|
464
639
|
const outlineColorIsDynamic = typeof outlineColor === "string";
|
|
465
640
|
const outlineOpacityIsDynamic = typeof outlineOpacity === "number";
|
|
466
641
|
const outlineWidthIsDynamic = typeof outlineWidth === "number";
|
|
@@ -511,7 +686,7 @@ var MapPointDrawing = ({
|
|
|
511
686
|
sourceId,
|
|
512
687
|
...zoomCompensation === undefined ? {} : { zoomCompensation }
|
|
513
688
|
};
|
|
514
|
-
|
|
689
|
+
useEffect4(() => {
|
|
515
690
|
if (!map || !optionsRef.current) {
|
|
516
691
|
return;
|
|
517
692
|
}
|
|
@@ -525,6 +700,7 @@ var MapPointDrawing = ({
|
|
|
525
700
|
continueRender(loadingHandle);
|
|
526
701
|
};
|
|
527
702
|
layerIdsRef.current = helpers2.addPoint(map, optionsRef.current);
|
|
703
|
+
applyPremountVisibility();
|
|
528
704
|
map.once("idle", finish);
|
|
529
705
|
map.triggerRepaint();
|
|
530
706
|
return () => {
|
|
@@ -549,8 +725,16 @@ var MapPointDrawing = ({
|
|
|
549
725
|
layerIdsRef.current = null;
|
|
550
726
|
map.triggerRepaint();
|
|
551
727
|
};
|
|
552
|
-
}, [
|
|
553
|
-
|
|
728
|
+
}, [
|
|
729
|
+
applyPremountVisibility,
|
|
730
|
+
continueRender,
|
|
731
|
+
delayRender,
|
|
732
|
+
layerId,
|
|
733
|
+
map,
|
|
734
|
+
structuralKey,
|
|
735
|
+
styleRevision
|
|
736
|
+
]);
|
|
737
|
+
useEffect4(() => {
|
|
554
738
|
if (!map || typeof data === "string") {
|
|
555
739
|
return;
|
|
556
740
|
}
|
|
@@ -565,7 +749,7 @@ var MapPointDrawing = ({
|
|
|
565
749
|
});
|
|
566
750
|
}
|
|
567
751
|
}, [continueRender, data, delayRender, layerId, map]);
|
|
568
|
-
|
|
752
|
+
useEffect4(() => {
|
|
569
753
|
if (!map) {
|
|
570
754
|
return;
|
|
571
755
|
}
|
|
@@ -640,23 +824,52 @@ var MapPoint = (props) => {
|
|
|
640
824
|
durationInFrames,
|
|
641
825
|
freeze,
|
|
642
826
|
from,
|
|
827
|
+
premountFor,
|
|
828
|
+
postmountFor,
|
|
643
829
|
hidden,
|
|
644
830
|
name,
|
|
645
831
|
showInTimeline,
|
|
646
|
-
trimBefore
|
|
832
|
+
trimBefore,
|
|
833
|
+
playbackRate
|
|
647
834
|
} = props;
|
|
648
|
-
|
|
649
|
-
|
|
835
|
+
const {
|
|
836
|
+
effectivePremountFor,
|
|
837
|
+
effectivePostmountFor,
|
|
838
|
+
freezeFrame,
|
|
839
|
+
isPremountingOrPostmounting,
|
|
840
|
+
premountingActive,
|
|
841
|
+
postmountingActive
|
|
842
|
+
} = Internals5.usePremounting({
|
|
650
843
|
from: from ?? 0,
|
|
651
|
-
trimBefore,
|
|
652
844
|
durationInFrames: durationInFrames ?? Infinity,
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
845
|
+
premountFor: premountFor ?? null,
|
|
846
|
+
postmountFor: postmountFor ?? null,
|
|
847
|
+
style: null,
|
|
848
|
+
styleWhilePremounted: null,
|
|
849
|
+
styleWhilePostmounted: null,
|
|
850
|
+
hideWhilePremounted: "opacity"
|
|
851
|
+
});
|
|
852
|
+
return /* @__PURE__ */ jsx4(Freeze4, {
|
|
853
|
+
frame: freezeFrame,
|
|
854
|
+
active: isPremountingOrPostmounting,
|
|
855
|
+
children: /* @__PURE__ */ jsx4(Sequence4, {
|
|
856
|
+
layout: "none",
|
|
857
|
+
from: from ?? 0,
|
|
858
|
+
trimBefore,
|
|
859
|
+
playbackRate,
|
|
860
|
+
durationInFrames: durationInFrames ?? Infinity,
|
|
861
|
+
freeze,
|
|
862
|
+
hidden,
|
|
863
|
+
name: name ?? "<MapPoint>",
|
|
864
|
+
showInTimeline: showInTimeline ?? true,
|
|
865
|
+
controls,
|
|
866
|
+
_remotionInternalPremountDisplay: effectivePremountFor || null,
|
|
867
|
+
_remotionInternalPostmountDisplay: effectivePostmountFor || null,
|
|
868
|
+
_remotionInternalIsPremounting: premountingActive,
|
|
869
|
+
_remotionInternalIsPostmounting: postmountingActive,
|
|
870
|
+
children: /* @__PURE__ */ jsx4(MapPointDrawing, {
|
|
871
|
+
...props
|
|
872
|
+
})
|
|
660
873
|
})
|
|
661
874
|
});
|
|
662
875
|
};
|
|
@@ -664,9 +877,11 @@ var MapPoint = (props) => {
|
|
|
664
877
|
import {
|
|
665
878
|
helpers as helpers4
|
|
666
879
|
} from "@maptiler/sdk";
|
|
667
|
-
import { useContext as
|
|
880
|
+
import { useContext as useContext8, useEffect as useEffect6, useMemo as useMemo2, useRef as useRef7 } from "react";
|
|
668
881
|
import {
|
|
669
|
-
|
|
882
|
+
Freeze as Freeze6,
|
|
883
|
+
Sequence as Sequence6,
|
|
884
|
+
Internals as Internals7,
|
|
670
885
|
useDelayRender as useDelayRender5
|
|
671
886
|
} from "remotion";
|
|
672
887
|
|
|
@@ -675,12 +890,14 @@ import {
|
|
|
675
890
|
helpers as helpers3
|
|
676
891
|
} from "@maptiler/sdk";
|
|
677
892
|
import { length as getLineLength, lineSliceAlong, lineString } from "@turf/turf";
|
|
678
|
-
import { useContext as
|
|
893
|
+
import { useContext as useContext7, useEffect as useEffect5, useRef as useRef6, useState } from "react";
|
|
679
894
|
import {
|
|
680
|
-
|
|
895
|
+
Freeze as Freeze5,
|
|
896
|
+
Sequence as Sequence5,
|
|
897
|
+
Internals as Internals6,
|
|
681
898
|
useDelayRender as useDelayRender4
|
|
682
899
|
} from "remotion";
|
|
683
|
-
import { jsx as
|
|
900
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
684
901
|
var normalizeData = (data) => {
|
|
685
902
|
if (typeof data === "string" || data.type === "FeatureCollection") {
|
|
686
903
|
return data;
|
|
@@ -755,10 +972,11 @@ var MapPolylineDrawing = ({
|
|
|
755
972
|
progress = 1,
|
|
756
973
|
sourceId = `${layerId}-source`
|
|
757
974
|
}) => {
|
|
758
|
-
const { map, styleRevision } =
|
|
975
|
+
const { map, styleRevision } = useContext7(MapTilerContext);
|
|
759
976
|
const { cancelRender, continueRender, delayRender } = useDelayRender4();
|
|
760
|
-
const layerIdsRef =
|
|
761
|
-
const
|
|
977
|
+
const layerIdsRef = useRef6(null);
|
|
978
|
+
const applyPremountVisibility = useMapPremounting(() => Object.entries(layerIdsRef.current ?? {}).filter(([key]) => key.endsWith("LayerId")).map(([, value]) => value));
|
|
979
|
+
const optionsRef = useRef6(null);
|
|
762
980
|
const [layerRevision, setLayerRevision] = useState(0);
|
|
763
981
|
const lineBlurIsDynamic = typeof lineBlur === "number";
|
|
764
982
|
const lineColorIsDynamic = typeof lineColor === "string";
|
|
@@ -809,7 +1027,7 @@ var MapPolylineDrawing = ({
|
|
|
809
1027
|
...outlineWidth === undefined ? {} : { outlineWidth },
|
|
810
1028
|
sourceId
|
|
811
1029
|
};
|
|
812
|
-
|
|
1030
|
+
useEffect5(() => {
|
|
813
1031
|
if (!map || !optionsRef.current) {
|
|
814
1032
|
return;
|
|
815
1033
|
}
|
|
@@ -840,6 +1058,7 @@ var MapPolylineDrawing = ({
|
|
|
840
1058
|
return;
|
|
841
1059
|
}
|
|
842
1060
|
layerIdsRef.current = ids;
|
|
1061
|
+
applyPremountVisibility();
|
|
843
1062
|
setLayerRevision((revision) => revision + 1);
|
|
844
1063
|
map.once("idle", finish);
|
|
845
1064
|
map.triggerRepaint();
|
|
@@ -861,6 +1080,7 @@ var MapPolylineDrawing = ({
|
|
|
861
1080
|
}
|
|
862
1081
|
};
|
|
863
1082
|
}, [
|
|
1083
|
+
applyPremountVisibility,
|
|
864
1084
|
cancelRender,
|
|
865
1085
|
continueRender,
|
|
866
1086
|
delayRender,
|
|
@@ -869,7 +1089,7 @@ var MapPolylineDrawing = ({
|
|
|
869
1089
|
structuralKey,
|
|
870
1090
|
styleRevision
|
|
871
1091
|
]);
|
|
872
|
-
|
|
1092
|
+
useEffect5(() => {
|
|
873
1093
|
if (!map || typeof data === "string") {
|
|
874
1094
|
return;
|
|
875
1095
|
}
|
|
@@ -892,7 +1112,7 @@ var MapPolylineDrawing = ({
|
|
|
892
1112
|
map,
|
|
893
1113
|
progress
|
|
894
1114
|
]);
|
|
895
|
-
|
|
1115
|
+
useEffect5(() => {
|
|
896
1116
|
if (!map) {
|
|
897
1117
|
return;
|
|
898
1118
|
}
|
|
@@ -987,29 +1207,58 @@ var MapPolyline = (props) => {
|
|
|
987
1207
|
durationInFrames,
|
|
988
1208
|
freeze,
|
|
989
1209
|
from,
|
|
1210
|
+
premountFor,
|
|
1211
|
+
postmountFor,
|
|
990
1212
|
hidden,
|
|
991
1213
|
name,
|
|
992
1214
|
showInTimeline,
|
|
993
|
-
trimBefore
|
|
1215
|
+
trimBefore,
|
|
1216
|
+
playbackRate
|
|
994
1217
|
} = props;
|
|
995
|
-
|
|
996
|
-
|
|
1218
|
+
const {
|
|
1219
|
+
effectivePremountFor,
|
|
1220
|
+
effectivePostmountFor,
|
|
1221
|
+
freezeFrame,
|
|
1222
|
+
isPremountingOrPostmounting,
|
|
1223
|
+
premountingActive,
|
|
1224
|
+
postmountingActive
|
|
1225
|
+
} = Internals6.usePremounting({
|
|
997
1226
|
from: from ?? 0,
|
|
998
|
-
trimBefore,
|
|
999
1227
|
durationInFrames: durationInFrames ?? Infinity,
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1228
|
+
premountFor: premountFor ?? null,
|
|
1229
|
+
postmountFor: postmountFor ?? null,
|
|
1230
|
+
style: null,
|
|
1231
|
+
styleWhilePremounted: null,
|
|
1232
|
+
styleWhilePostmounted: null,
|
|
1233
|
+
hideWhilePremounted: "opacity"
|
|
1234
|
+
});
|
|
1235
|
+
return /* @__PURE__ */ jsx5(Freeze5, {
|
|
1236
|
+
frame: freezeFrame,
|
|
1237
|
+
active: isPremountingOrPostmounting,
|
|
1238
|
+
children: /* @__PURE__ */ jsx5(Sequence5, {
|
|
1239
|
+
layout: "none",
|
|
1240
|
+
from: from ?? 0,
|
|
1241
|
+
trimBefore,
|
|
1242
|
+
playbackRate,
|
|
1243
|
+
durationInFrames: durationInFrames ?? Infinity,
|
|
1244
|
+
freeze,
|
|
1245
|
+
hidden,
|
|
1246
|
+
name: name ?? "<MapPolyline>",
|
|
1247
|
+
showInTimeline: showInTimeline ?? true,
|
|
1248
|
+
controls,
|
|
1249
|
+
_remotionInternalPremountDisplay: effectivePremountFor || null,
|
|
1250
|
+
_remotionInternalPostmountDisplay: effectivePostmountFor || null,
|
|
1251
|
+
_remotionInternalIsPremounting: premountingActive,
|
|
1252
|
+
_remotionInternalIsPostmounting: postmountingActive,
|
|
1253
|
+
children: /* @__PURE__ */ jsx5(MapPolylineDrawing, {
|
|
1254
|
+
...props
|
|
1255
|
+
})
|
|
1007
1256
|
})
|
|
1008
1257
|
});
|
|
1009
1258
|
};
|
|
1010
1259
|
|
|
1011
1260
|
// src/MapPolygon.tsx
|
|
1012
|
-
import { jsx as
|
|
1261
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1013
1262
|
var normalizeData2 = (data) => {
|
|
1014
1263
|
if (typeof data === "string" || data.type === "FeatureCollection") {
|
|
1015
1264
|
return data;
|
|
@@ -1070,10 +1319,11 @@ var MapPolygonDrawing = ({
|
|
|
1070
1319
|
progress,
|
|
1071
1320
|
sourceId = `${layerId}-source`
|
|
1072
1321
|
}) => {
|
|
1073
|
-
const { map, styleRevision } =
|
|
1322
|
+
const { map, styleRevision } = useContext8(MapTilerContext);
|
|
1074
1323
|
const { continueRender, delayRender } = useDelayRender5();
|
|
1075
|
-
const layerIdsRef =
|
|
1076
|
-
const
|
|
1324
|
+
const layerIdsRef = useRef7(null);
|
|
1325
|
+
const applyPremountVisibility = useMapPremounting(() => Object.entries(layerIdsRef.current ?? {}).filter(([key]) => key.endsWith("LayerId")).map(([, value]) => value));
|
|
1326
|
+
const optionsRef = useRef7(null);
|
|
1077
1327
|
const fillColorIsDynamic = typeof fillColor === "string";
|
|
1078
1328
|
const fillOpacityIsDynamic = typeof fillOpacity === "number";
|
|
1079
1329
|
const outlineBlurIsDynamic = typeof outlineBlur === "number";
|
|
@@ -1081,7 +1331,7 @@ var MapPolygonDrawing = ({
|
|
|
1081
1331
|
const outlineOpacityIsDynamic = typeof outlineOpacity === "number";
|
|
1082
1332
|
const outlineWidthIsDynamic = typeof outlineWidth === "number";
|
|
1083
1333
|
const shouldAnimateOutline = progress !== undefined;
|
|
1084
|
-
const outlineData =
|
|
1334
|
+
const outlineData = useMemo2(() => shouldAnimateOutline ? getOutlineData(data) : null, [data, shouldAnimateOutline]);
|
|
1085
1335
|
const hasAnimatedOutline = outlineData !== null && outline !== false;
|
|
1086
1336
|
const structuralKey = JSON.stringify({
|
|
1087
1337
|
beforeId,
|
|
@@ -1122,7 +1372,7 @@ var MapPolygonDrawing = ({
|
|
|
1122
1372
|
...pattern === undefined ? {} : { pattern },
|
|
1123
1373
|
sourceId
|
|
1124
1374
|
};
|
|
1125
|
-
|
|
1375
|
+
useEffect6(() => {
|
|
1126
1376
|
if (!map || !optionsRef.current) {
|
|
1127
1377
|
return;
|
|
1128
1378
|
}
|
|
@@ -1136,6 +1386,7 @@ var MapPolygonDrawing = ({
|
|
|
1136
1386
|
continueRender(loadingHandle);
|
|
1137
1387
|
};
|
|
1138
1388
|
layerIdsRef.current = helpers4.addPolygon(map, optionsRef.current);
|
|
1389
|
+
applyPremountVisibility();
|
|
1139
1390
|
map.once("idle", finish);
|
|
1140
1391
|
map.triggerRepaint();
|
|
1141
1392
|
return () => {
|
|
@@ -1156,8 +1407,16 @@ var MapPolygonDrawing = ({
|
|
|
1156
1407
|
layerIdsRef.current = null;
|
|
1157
1408
|
map.triggerRepaint();
|
|
1158
1409
|
};
|
|
1159
|
-
}, [
|
|
1160
|
-
|
|
1410
|
+
}, [
|
|
1411
|
+
applyPremountVisibility,
|
|
1412
|
+
continueRender,
|
|
1413
|
+
delayRender,
|
|
1414
|
+
layerId,
|
|
1415
|
+
map,
|
|
1416
|
+
structuralKey,
|
|
1417
|
+
styleRevision
|
|
1418
|
+
]);
|
|
1419
|
+
useEffect6(() => {
|
|
1161
1420
|
if (!map || typeof data === "string") {
|
|
1162
1421
|
return;
|
|
1163
1422
|
}
|
|
@@ -1172,7 +1431,7 @@ var MapPolygonDrawing = ({
|
|
|
1172
1431
|
});
|
|
1173
1432
|
}
|
|
1174
1433
|
}, [continueRender, data, delayRender, layerId, map]);
|
|
1175
|
-
|
|
1434
|
+
useEffect6(() => {
|
|
1176
1435
|
if (!map) {
|
|
1177
1436
|
return;
|
|
1178
1437
|
}
|
|
@@ -1229,7 +1488,7 @@ var MapPolygonDrawing = ({
|
|
|
1229
1488
|
if (!hasAnimatedOutline) {
|
|
1230
1489
|
return null;
|
|
1231
1490
|
}
|
|
1232
|
-
return /* @__PURE__ */
|
|
1491
|
+
return /* @__PURE__ */ jsx6(MapPolyline, {
|
|
1233
1492
|
beforeId,
|
|
1234
1493
|
data: outlineData,
|
|
1235
1494
|
layerId: `${layerId}-outline`,
|
|
@@ -1254,23 +1513,52 @@ var MapPolygon = (props) => {
|
|
|
1254
1513
|
durationInFrames,
|
|
1255
1514
|
freeze,
|
|
1256
1515
|
from,
|
|
1516
|
+
premountFor,
|
|
1517
|
+
postmountFor,
|
|
1257
1518
|
hidden,
|
|
1258
1519
|
name,
|
|
1259
1520
|
showInTimeline,
|
|
1260
|
-
trimBefore
|
|
1521
|
+
trimBefore,
|
|
1522
|
+
playbackRate
|
|
1261
1523
|
} = props;
|
|
1262
|
-
|
|
1263
|
-
|
|
1524
|
+
const {
|
|
1525
|
+
effectivePremountFor,
|
|
1526
|
+
effectivePostmountFor,
|
|
1527
|
+
freezeFrame,
|
|
1528
|
+
isPremountingOrPostmounting,
|
|
1529
|
+
premountingActive,
|
|
1530
|
+
postmountingActive
|
|
1531
|
+
} = Internals7.usePremounting({
|
|
1264
1532
|
from: from ?? 0,
|
|
1265
|
-
trimBefore,
|
|
1266
1533
|
durationInFrames: durationInFrames ?? Infinity,
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1534
|
+
premountFor: premountFor ?? null,
|
|
1535
|
+
postmountFor: postmountFor ?? null,
|
|
1536
|
+
style: null,
|
|
1537
|
+
styleWhilePremounted: null,
|
|
1538
|
+
styleWhilePostmounted: null,
|
|
1539
|
+
hideWhilePremounted: "opacity"
|
|
1540
|
+
});
|
|
1541
|
+
return /* @__PURE__ */ jsx6(Freeze6, {
|
|
1542
|
+
frame: freezeFrame,
|
|
1543
|
+
active: isPremountingOrPostmounting,
|
|
1544
|
+
children: /* @__PURE__ */ jsx6(Sequence6, {
|
|
1545
|
+
layout: "none",
|
|
1546
|
+
from: from ?? 0,
|
|
1547
|
+
trimBefore,
|
|
1548
|
+
playbackRate,
|
|
1549
|
+
durationInFrames: durationInFrames ?? Infinity,
|
|
1550
|
+
freeze,
|
|
1551
|
+
hidden,
|
|
1552
|
+
name: name ?? "<MapPolygon>",
|
|
1553
|
+
showInTimeline: showInTimeline ?? true,
|
|
1554
|
+
controls,
|
|
1555
|
+
_remotionInternalPremountDisplay: effectivePremountFor || null,
|
|
1556
|
+
_remotionInternalPostmountDisplay: effectivePostmountFor || null,
|
|
1557
|
+
_remotionInternalIsPremounting: premountingActive,
|
|
1558
|
+
_remotionInternalIsPostmounting: postmountingActive,
|
|
1559
|
+
children: /* @__PURE__ */ jsx6(MapPolygonDrawing, {
|
|
1560
|
+
...props
|
|
1561
|
+
})
|
|
1274
1562
|
})
|
|
1275
1563
|
});
|
|
1276
1564
|
};
|
|
@@ -1278,21 +1566,27 @@ var MapPolygon = (props) => {
|
|
|
1278
1566
|
import { length as getLineLength2, lineSliceAlong as lineSliceAlong2, lineString as lineString2 } from "@turf/turf";
|
|
1279
1567
|
import {
|
|
1280
1568
|
forwardRef as forwardRef2,
|
|
1281
|
-
useContext as
|
|
1282
|
-
useEffect as
|
|
1569
|
+
useContext as useContext9,
|
|
1570
|
+
useEffect as useEffect7,
|
|
1283
1571
|
useImperativeHandle as useImperativeHandle2,
|
|
1284
|
-
useMemo as
|
|
1285
|
-
useRef as
|
|
1572
|
+
useMemo as useMemo3,
|
|
1573
|
+
useRef as useRef8,
|
|
1286
1574
|
useState as useState2
|
|
1287
1575
|
} from "react";
|
|
1288
1576
|
import {
|
|
1289
1577
|
Interactive as Interactive2,
|
|
1290
|
-
|
|
1578
|
+
Freeze as Freeze7,
|
|
1579
|
+
Sequence as Sequence7,
|
|
1580
|
+
Internals as Internals8,
|
|
1291
1581
|
useDelayRender as useDelayRender6
|
|
1292
1582
|
} from "remotion";
|
|
1293
|
-
import { jsx as
|
|
1583
|
+
import { jsx as jsx7, jsxs, Fragment } from "react/jsx-runtime";
|
|
1294
1584
|
var mapRegionSchema = {
|
|
1295
1585
|
...Interactive2.baseSchema,
|
|
1586
|
+
...{
|
|
1587
|
+
premountFor: Interactive2.premountSchema.premountFor,
|
|
1588
|
+
postmountFor: Interactive2.premountSchema.postmountFor
|
|
1589
|
+
},
|
|
1296
1590
|
fill: {
|
|
1297
1591
|
type: "number",
|
|
1298
1592
|
min: 0,
|
|
@@ -1352,16 +1646,21 @@ var MapRegionDrawing = ({
|
|
|
1352
1646
|
strokeColor = "#8f1712",
|
|
1353
1647
|
strokeWidth = 9
|
|
1354
1648
|
}) => {
|
|
1355
|
-
const { map } =
|
|
1649
|
+
const { map } = useContext9(MapTilerContext);
|
|
1356
1650
|
const { continueRender, delayRender } = useDelayRender6();
|
|
1357
1651
|
const [isReady, setIsReady] = useState2(false);
|
|
1358
1652
|
const [loadingHandle] = useState2(() => delayRender(`Loading ${feature.properties.name} geometry`));
|
|
1359
|
-
const outline =
|
|
1360
|
-
const outlineLength =
|
|
1653
|
+
const outline = useMemo3(() => lineString2(feature.geometry.coordinates[0]), [feature]);
|
|
1654
|
+
const outlineLength = useMemo3(() => getLineLength2(outline), [outline]);
|
|
1361
1655
|
const fillSourceId = `${id}-fill`;
|
|
1362
1656
|
const outlineSourceId = `${id}-outline`;
|
|
1363
1657
|
const outlineGlowLayerId = `${id}-outline-glow`;
|
|
1364
|
-
|
|
1658
|
+
const applyPremountVisibility = useMapPremounting(() => [
|
|
1659
|
+
fillSourceId,
|
|
1660
|
+
outlineSourceId,
|
|
1661
|
+
outlineGlowLayerId
|
|
1662
|
+
]);
|
|
1663
|
+
useEffect7(() => {
|
|
1365
1664
|
if (!map) {
|
|
1366
1665
|
return;
|
|
1367
1666
|
}
|
|
@@ -1424,12 +1723,14 @@ var MapRegionDrawing = ({
|
|
|
1424
1723
|
}
|
|
1425
1724
|
map.setPaintProperty(outlineSourceId, "line-color", strokeColor);
|
|
1426
1725
|
map.setPaintProperty(outlineSourceId, "line-width", strokeWidth);
|
|
1726
|
+
applyPremountVisibility();
|
|
1427
1727
|
map.once("idle", () => {
|
|
1428
1728
|
setIsReady(true);
|
|
1429
1729
|
continueRender(loadingHandle);
|
|
1430
1730
|
});
|
|
1431
1731
|
map.triggerRepaint();
|
|
1432
1732
|
}, [
|
|
1733
|
+
applyPremountVisibility,
|
|
1433
1734
|
continueRender,
|
|
1434
1735
|
feature,
|
|
1435
1736
|
fillColor,
|
|
@@ -1443,7 +1744,7 @@ var MapRegionDrawing = ({
|
|
|
1443
1744
|
strokeColor,
|
|
1444
1745
|
strokeWidth
|
|
1445
1746
|
]);
|
|
1446
|
-
|
|
1747
|
+
useEffect7(() => {
|
|
1447
1748
|
if (!isReady || !map) {
|
|
1448
1749
|
return;
|
|
1449
1750
|
}
|
|
@@ -1465,7 +1766,7 @@ var MapRegionDrawing = ({
|
|
|
1465
1766
|
outlineSourceId,
|
|
1466
1767
|
progress
|
|
1467
1768
|
]);
|
|
1468
|
-
|
|
1769
|
+
useEffect7(() => {
|
|
1469
1770
|
if (!map) {
|
|
1470
1771
|
return;
|
|
1471
1772
|
}
|
|
@@ -1494,9 +1795,9 @@ var MapRegionBounds = ({
|
|
|
1494
1795
|
feature,
|
|
1495
1796
|
refForOutline
|
|
1496
1797
|
}) => {
|
|
1497
|
-
const { map } =
|
|
1798
|
+
const { map } = useContext9(MapTilerContext);
|
|
1498
1799
|
if (!map) {
|
|
1499
|
-
return /* @__PURE__ */
|
|
1800
|
+
return /* @__PURE__ */ jsx7("div", {
|
|
1500
1801
|
ref: refForOutline
|
|
1501
1802
|
});
|
|
1502
1803
|
}
|
|
@@ -1505,7 +1806,7 @@ var MapRegionBounds = ({
|
|
|
1505
1806
|
const right = Math.max(...points.map((point) => point.x));
|
|
1506
1807
|
const top = Math.min(...points.map((point) => point.y));
|
|
1507
1808
|
const bottom = Math.max(...points.map((point) => point.y));
|
|
1508
|
-
return /* @__PURE__ */
|
|
1809
|
+
return /* @__PURE__ */ jsx7("div", {
|
|
1509
1810
|
ref: refForOutline,
|
|
1510
1811
|
style: {
|
|
1511
1812
|
height: bottom - top,
|
|
@@ -1530,42 +1831,73 @@ var MapRegionRefForwardingFunction = ({
|
|
|
1530
1831
|
strokeWidth = 9,
|
|
1531
1832
|
durationInFrames,
|
|
1532
1833
|
from,
|
|
1834
|
+
premountFor,
|
|
1835
|
+
postmountFor,
|
|
1533
1836
|
trimBefore,
|
|
1837
|
+
playbackRate,
|
|
1534
1838
|
freeze,
|
|
1535
1839
|
hidden,
|
|
1536
1840
|
name,
|
|
1537
1841
|
showInTimeline,
|
|
1538
1842
|
controls
|
|
1539
1843
|
}, ref) => {
|
|
1540
|
-
const refForOutline =
|
|
1844
|
+
const refForOutline = useRef8(null);
|
|
1541
1845
|
useImperativeHandle2(ref, () => refForOutline.current, []);
|
|
1542
|
-
|
|
1543
|
-
|
|
1846
|
+
const {
|
|
1847
|
+
effectivePremountFor,
|
|
1848
|
+
effectivePostmountFor,
|
|
1849
|
+
freezeFrame,
|
|
1850
|
+
isPremountingOrPostmounting,
|
|
1851
|
+
premountingActive,
|
|
1852
|
+
postmountingActive
|
|
1853
|
+
} = Internals8.usePremounting({
|
|
1544
1854
|
from: from ?? 0,
|
|
1545
|
-
trimBefore,
|
|
1546
1855
|
durationInFrames: durationInFrames ?? Infinity,
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1856
|
+
premountFor: premountFor ?? null,
|
|
1857
|
+
postmountFor: postmountFor ?? null,
|
|
1858
|
+
style: null,
|
|
1859
|
+
styleWhilePremounted: null,
|
|
1860
|
+
styleWhilePostmounted: null,
|
|
1861
|
+
hideWhilePremounted: "opacity"
|
|
1862
|
+
});
|
|
1863
|
+
return /* @__PURE__ */ jsx7(Freeze7, {
|
|
1864
|
+
frame: freezeFrame,
|
|
1865
|
+
active: isPremountingOrPostmounting,
|
|
1866
|
+
children: /* @__PURE__ */ jsx7(Sequence7, {
|
|
1867
|
+
layout: "none",
|
|
1868
|
+
from: from ?? 0,
|
|
1869
|
+
trimBefore,
|
|
1870
|
+
playbackRate,
|
|
1871
|
+
durationInFrames: durationInFrames ?? Infinity,
|
|
1872
|
+
freeze,
|
|
1873
|
+
hidden,
|
|
1874
|
+
name: name ?? `<${feature.properties.name}>`,
|
|
1875
|
+
showInTimeline: showInTimeline ?? true,
|
|
1876
|
+
controls,
|
|
1877
|
+
outlineRef: refForOutline,
|
|
1878
|
+
_remotionInternalPremountDisplay: effectivePremountFor || null,
|
|
1879
|
+
_remotionInternalPostmountDisplay: effectivePostmountFor || null,
|
|
1880
|
+
_remotionInternalIsPremounting: premountingActive,
|
|
1881
|
+
_remotionInternalIsPostmounting: postmountingActive,
|
|
1882
|
+
children: /* @__PURE__ */ jsxs(Fragment, {
|
|
1883
|
+
children: [
|
|
1884
|
+
/* @__PURE__ */ jsx7(MapRegionDrawing, {
|
|
1885
|
+
feature,
|
|
1886
|
+
fill,
|
|
1887
|
+
fillColor,
|
|
1888
|
+
glow,
|
|
1889
|
+
id,
|
|
1890
|
+
progress,
|
|
1891
|
+
strokeColor,
|
|
1892
|
+
strokeWidth
|
|
1893
|
+
}),
|
|
1894
|
+
/* @__PURE__ */ jsx7(MapRegionBounds, {
|
|
1895
|
+
feature,
|
|
1896
|
+
refForOutline
|
|
1897
|
+
})
|
|
1898
|
+
]
|
|
1567
1899
|
})
|
|
1568
|
-
|
|
1900
|
+
})
|
|
1569
1901
|
});
|
|
1570
1902
|
};
|
|
1571
1903
|
var MapRegionInner = forwardRef2(MapRegionRefForwardingFunction);
|
|
@@ -1579,21 +1911,27 @@ var MapRegion = Interactive2.withSchema({
|
|
|
1579
1911
|
import { length as getLineLength3, lineSliceAlong as lineSliceAlong3, lineString as lineString3 } from "@turf/turf";
|
|
1580
1912
|
import {
|
|
1581
1913
|
forwardRef as forwardRef3,
|
|
1582
|
-
useContext as
|
|
1583
|
-
useEffect as
|
|
1914
|
+
useContext as useContext10,
|
|
1915
|
+
useEffect as useEffect8,
|
|
1584
1916
|
useImperativeHandle as useImperativeHandle3,
|
|
1585
|
-
useMemo as
|
|
1586
|
-
useRef as
|
|
1917
|
+
useMemo as useMemo4,
|
|
1918
|
+
useRef as useRef9,
|
|
1587
1919
|
useState as useState3
|
|
1588
1920
|
} from "react";
|
|
1589
1921
|
import {
|
|
1590
1922
|
Interactive as Interactive3,
|
|
1591
|
-
|
|
1923
|
+
Freeze as Freeze8,
|
|
1924
|
+
Sequence as Sequence8,
|
|
1925
|
+
Internals as Internals9,
|
|
1592
1926
|
useDelayRender as useDelayRender7
|
|
1593
1927
|
} from "remotion";
|
|
1594
|
-
import { jsx as
|
|
1928
|
+
import { jsx as jsx8, jsxs as jsxs2, Fragment as Fragment2 } from "react/jsx-runtime";
|
|
1595
1929
|
var mapRouteSchema = {
|
|
1596
1930
|
...Interactive3.baseSchema,
|
|
1931
|
+
...{
|
|
1932
|
+
premountFor: Interactive3.premountSchema.premountFor,
|
|
1933
|
+
postmountFor: Interactive3.premountSchema.postmountFor
|
|
1934
|
+
},
|
|
1597
1935
|
glow: {
|
|
1598
1936
|
type: "number",
|
|
1599
1937
|
min: 0,
|
|
@@ -1636,15 +1974,19 @@ var MapRouteDrawing = ({
|
|
|
1636
1974
|
strokeColor = "#006cff",
|
|
1637
1975
|
strokeWidth = 9
|
|
1638
1976
|
}) => {
|
|
1639
|
-
const { map } =
|
|
1977
|
+
const { map } = useContext10(MapTilerContext);
|
|
1640
1978
|
const { continueRender, delayRender } = useDelayRender7();
|
|
1641
1979
|
const [isReady, setIsReady] = useState3(false);
|
|
1642
1980
|
const [loadingHandle] = useState3(() => delayRender(`Loading ${feature.properties.name} route`));
|
|
1643
|
-
const route =
|
|
1644
|
-
const routeLength =
|
|
1981
|
+
const route = useMemo4(() => lineString3(feature.geometry.coordinates), [feature]);
|
|
1982
|
+
const routeLength = useMemo4(() => getLineLength3(route), [route]);
|
|
1645
1983
|
const sourceId = `${id}-route`;
|
|
1646
1984
|
const glowLayerId = `${id}-route-glow`;
|
|
1647
|
-
|
|
1985
|
+
const applyPremountVisibility = useMapPremounting(() => [
|
|
1986
|
+
sourceId,
|
|
1987
|
+
glowLayerId
|
|
1988
|
+
]);
|
|
1989
|
+
useEffect8(() => {
|
|
1648
1990
|
if (!map) {
|
|
1649
1991
|
return;
|
|
1650
1992
|
}
|
|
@@ -1687,12 +2029,14 @@ var MapRouteDrawing = ({
|
|
|
1687
2029
|
}
|
|
1688
2030
|
map.setPaintProperty(sourceId, "line-color", strokeColor);
|
|
1689
2031
|
map.setPaintProperty(sourceId, "line-width", strokeWidth);
|
|
2032
|
+
applyPremountVisibility();
|
|
1690
2033
|
map.once("idle", () => {
|
|
1691
2034
|
setIsReady(true);
|
|
1692
2035
|
continueRender(loadingHandle);
|
|
1693
2036
|
});
|
|
1694
2037
|
map.triggerRepaint();
|
|
1695
2038
|
}, [
|
|
2039
|
+
applyPremountVisibility,
|
|
1696
2040
|
continueRender,
|
|
1697
2041
|
glow,
|
|
1698
2042
|
glowLayerId,
|
|
@@ -1703,7 +2047,7 @@ var MapRouteDrawing = ({
|
|
|
1703
2047
|
strokeColor,
|
|
1704
2048
|
strokeWidth
|
|
1705
2049
|
]);
|
|
1706
|
-
|
|
2050
|
+
useEffect8(() => {
|
|
1707
2051
|
if (!isReady || !map) {
|
|
1708
2052
|
return;
|
|
1709
2053
|
}
|
|
@@ -1722,7 +2066,7 @@ var MapRouteDrawing = ({
|
|
|
1722
2066
|
routeLength,
|
|
1723
2067
|
sourceId
|
|
1724
2068
|
]);
|
|
1725
|
-
|
|
2069
|
+
useEffect8(() => {
|
|
1726
2070
|
if (!map) {
|
|
1727
2071
|
return;
|
|
1728
2072
|
}
|
|
@@ -1745,9 +2089,9 @@ var MapRouteBounds = ({
|
|
|
1745
2089
|
feature,
|
|
1746
2090
|
refForOutline
|
|
1747
2091
|
}) => {
|
|
1748
|
-
const { map } =
|
|
2092
|
+
const { map } = useContext10(MapTilerContext);
|
|
1749
2093
|
if (!map) {
|
|
1750
|
-
return /* @__PURE__ */
|
|
2094
|
+
return /* @__PURE__ */ jsx8("div", {
|
|
1751
2095
|
ref: refForOutline
|
|
1752
2096
|
});
|
|
1753
2097
|
}
|
|
@@ -1756,7 +2100,7 @@ var MapRouteBounds = ({
|
|
|
1756
2100
|
const right = Math.max(...points.map((point) => point.x));
|
|
1757
2101
|
const top = Math.min(...points.map((point) => point.y));
|
|
1758
2102
|
const bottom = Math.max(...points.map((point) => point.y));
|
|
1759
|
-
return /* @__PURE__ */
|
|
2103
|
+
return /* @__PURE__ */ jsx8("div", {
|
|
1760
2104
|
ref: refForOutline,
|
|
1761
2105
|
style: {
|
|
1762
2106
|
height: bottom - top,
|
|
@@ -1779,40 +2123,71 @@ var MapRouteRefForwardingFunction = ({
|
|
|
1779
2123
|
strokeWidth = 9,
|
|
1780
2124
|
durationInFrames,
|
|
1781
2125
|
from,
|
|
2126
|
+
premountFor,
|
|
2127
|
+
postmountFor,
|
|
1782
2128
|
trimBefore,
|
|
2129
|
+
playbackRate,
|
|
1783
2130
|
freeze,
|
|
1784
2131
|
hidden,
|
|
1785
2132
|
name,
|
|
1786
2133
|
showInTimeline,
|
|
1787
2134
|
controls
|
|
1788
2135
|
}, ref) => {
|
|
1789
|
-
const refForOutline =
|
|
2136
|
+
const refForOutline = useRef9(null);
|
|
1790
2137
|
useImperativeHandle3(ref, () => refForOutline.current, []);
|
|
1791
|
-
|
|
1792
|
-
|
|
2138
|
+
const {
|
|
2139
|
+
effectivePremountFor,
|
|
2140
|
+
effectivePostmountFor,
|
|
2141
|
+
freezeFrame,
|
|
2142
|
+
isPremountingOrPostmounting,
|
|
2143
|
+
premountingActive,
|
|
2144
|
+
postmountingActive
|
|
2145
|
+
} = Internals9.usePremounting({
|
|
1793
2146
|
from: from ?? 0,
|
|
1794
|
-
trimBefore,
|
|
1795
2147
|
durationInFrames: durationInFrames ?? Infinity,
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
2148
|
+
premountFor: premountFor ?? null,
|
|
2149
|
+
postmountFor: postmountFor ?? null,
|
|
2150
|
+
style: null,
|
|
2151
|
+
styleWhilePremounted: null,
|
|
2152
|
+
styleWhilePostmounted: null,
|
|
2153
|
+
hideWhilePremounted: "opacity"
|
|
2154
|
+
});
|
|
2155
|
+
return /* @__PURE__ */ jsx8(Freeze8, {
|
|
2156
|
+
frame: freezeFrame,
|
|
2157
|
+
active: isPremountingOrPostmounting,
|
|
2158
|
+
children: /* @__PURE__ */ jsx8(Sequence8, {
|
|
2159
|
+
layout: "none",
|
|
2160
|
+
from: from ?? 0,
|
|
2161
|
+
trimBefore,
|
|
2162
|
+
playbackRate,
|
|
2163
|
+
durationInFrames: durationInFrames ?? Infinity,
|
|
2164
|
+
freeze,
|
|
2165
|
+
hidden,
|
|
2166
|
+
name: name ?? `<${feature.properties.name}>`,
|
|
2167
|
+
showInTimeline: showInTimeline ?? true,
|
|
2168
|
+
controls,
|
|
2169
|
+
outlineRef: refForOutline,
|
|
2170
|
+
_remotionInternalPremountDisplay: effectivePremountFor || null,
|
|
2171
|
+
_remotionInternalPostmountDisplay: effectivePostmountFor || null,
|
|
2172
|
+
_remotionInternalIsPremounting: premountingActive,
|
|
2173
|
+
_remotionInternalIsPostmounting: postmountingActive,
|
|
2174
|
+
children: /* @__PURE__ */ jsxs2(Fragment2, {
|
|
2175
|
+
children: [
|
|
2176
|
+
/* @__PURE__ */ jsx8(MapRouteDrawing, {
|
|
2177
|
+
feature,
|
|
2178
|
+
glow,
|
|
2179
|
+
id,
|
|
2180
|
+
progress,
|
|
2181
|
+
strokeColor,
|
|
2182
|
+
strokeWidth
|
|
2183
|
+
}),
|
|
2184
|
+
/* @__PURE__ */ jsx8(MapRouteBounds, {
|
|
2185
|
+
feature,
|
|
2186
|
+
refForOutline
|
|
2187
|
+
})
|
|
2188
|
+
]
|
|
1814
2189
|
})
|
|
1815
|
-
|
|
2190
|
+
})
|
|
1816
2191
|
});
|
|
1817
2192
|
};
|
|
1818
2193
|
var MapRouteInner = forwardRef3(MapRouteRefForwardingFunction);
|
|
@@ -1823,14 +2198,20 @@ var MapRoute = Interactive3.withSchema({
|
|
|
1823
2198
|
supportsEffects: false
|
|
1824
2199
|
});
|
|
1825
2200
|
// src/MapSource.tsx
|
|
1826
|
-
import { useContext as
|
|
1827
|
-
import {
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
2201
|
+
import { useContext as useContext11, useEffect as useEffect9, useRef as useRef10 } from "react";
|
|
2202
|
+
import {
|
|
2203
|
+
Freeze as Freeze9,
|
|
2204
|
+
Sequence as Sequence9,
|
|
2205
|
+
Internals as Internals10,
|
|
2206
|
+
useDelayRender as useDelayRender8
|
|
2207
|
+
} from "remotion";
|
|
2208
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
2209
|
+
var MapSourceContent = ({ children, id, source }) => {
|
|
2210
|
+
const { map, styleRevision } = useContext11(MapTilerContext);
|
|
2211
|
+
const sourceRef = useRef10(source);
|
|
1831
2212
|
const { continueRender, delayRender } = useDelayRender8();
|
|
1832
2213
|
sourceRef.current = source;
|
|
1833
|
-
|
|
2214
|
+
useEffect9(() => {
|
|
1834
2215
|
if (!map) {
|
|
1835
2216
|
return;
|
|
1836
2217
|
}
|
|
@@ -1862,7 +2243,7 @@ var MapSource = ({ children, id, source }) => {
|
|
|
1862
2243
|
map.triggerRepaint();
|
|
1863
2244
|
};
|
|
1864
2245
|
}, [continueRender, delayRender, id, map, styleRevision]);
|
|
1865
|
-
|
|
2246
|
+
useEffect9(() => {
|
|
1866
2247
|
if (!map || source.type !== "geojson") {
|
|
1867
2248
|
return;
|
|
1868
2249
|
}
|
|
@@ -1880,23 +2261,78 @@ var MapSource = ({ children, id, source }) => {
|
|
|
1880
2261
|
}, [continueRender, delayRender, id, map, source]);
|
|
1881
2262
|
return children;
|
|
1882
2263
|
};
|
|
2264
|
+
var MapSource = ({
|
|
2265
|
+
from,
|
|
2266
|
+
durationInFrames,
|
|
2267
|
+
trimBefore,
|
|
2268
|
+
playbackRate,
|
|
2269
|
+
freeze,
|
|
2270
|
+
hidden,
|
|
2271
|
+
name,
|
|
2272
|
+
showInTimeline,
|
|
2273
|
+
premountFor,
|
|
2274
|
+
postmountFor,
|
|
2275
|
+
...props
|
|
2276
|
+
}) => {
|
|
2277
|
+
const {
|
|
2278
|
+
effectivePremountFor,
|
|
2279
|
+
effectivePostmountFor,
|
|
2280
|
+
freezeFrame,
|
|
2281
|
+
isPremountingOrPostmounting,
|
|
2282
|
+
premountingActive,
|
|
2283
|
+
postmountingActive
|
|
2284
|
+
} = Internals10.usePremounting({
|
|
2285
|
+
from: from ?? 0,
|
|
2286
|
+
durationInFrames: durationInFrames ?? Infinity,
|
|
2287
|
+
premountFor: premountFor ?? null,
|
|
2288
|
+
postmountFor: postmountFor ?? null,
|
|
2289
|
+
style: null,
|
|
2290
|
+
styleWhilePremounted: null,
|
|
2291
|
+
styleWhilePostmounted: null,
|
|
2292
|
+
hideWhilePremounted: "opacity"
|
|
2293
|
+
});
|
|
2294
|
+
return /* @__PURE__ */ jsx9(Freeze9, {
|
|
2295
|
+
frame: freezeFrame,
|
|
2296
|
+
active: isPremountingOrPostmounting,
|
|
2297
|
+
children: /* @__PURE__ */ jsx9(Sequence9, {
|
|
2298
|
+
layout: "none",
|
|
2299
|
+
from,
|
|
2300
|
+
durationInFrames,
|
|
2301
|
+
trimBefore,
|
|
2302
|
+
playbackRate,
|
|
2303
|
+
freeze,
|
|
2304
|
+
hidden,
|
|
2305
|
+
showInTimeline: showInTimeline ?? false,
|
|
2306
|
+
name: name ?? "<MapSource>",
|
|
2307
|
+
_remotionInternalPremountDisplay: effectivePremountFor || null,
|
|
2308
|
+
_remotionInternalPostmountDisplay: effectivePostmountFor || null,
|
|
2309
|
+
_remotionInternalIsPremounting: premountingActive,
|
|
2310
|
+
_remotionInternalIsPostmounting: postmountingActive,
|
|
2311
|
+
children: /* @__PURE__ */ jsx9(MapSourceContent, {
|
|
2312
|
+
...props
|
|
2313
|
+
})
|
|
2314
|
+
})
|
|
2315
|
+
});
|
|
2316
|
+
};
|
|
1883
2317
|
// src/MapViewport.tsx
|
|
1884
2318
|
import { Map as MapTilerMap, MapStyle } from "@maptiler/sdk";
|
|
1885
2319
|
import"@maptiler/sdk/style.css";
|
|
1886
2320
|
import {
|
|
1887
2321
|
forwardRef as forwardRef4,
|
|
1888
|
-
useEffect as
|
|
2322
|
+
useEffect as useEffect10,
|
|
1889
2323
|
useImperativeHandle as useImperativeHandle4,
|
|
1890
|
-
useMemo as
|
|
1891
|
-
useRef as
|
|
2324
|
+
useMemo as useMemo5,
|
|
2325
|
+
useRef as useRef11,
|
|
1892
2326
|
useState as useState4
|
|
1893
2327
|
} from "react";
|
|
1894
2328
|
import {
|
|
1895
2329
|
Interactive as Interactive4,
|
|
1896
|
-
|
|
2330
|
+
Freeze as Freeze10,
|
|
2331
|
+
Sequence as Sequence10,
|
|
2332
|
+
Internals as Internals11,
|
|
1897
2333
|
useDelayRender as useDelayRender9
|
|
1898
2334
|
} from "remotion";
|
|
1899
|
-
import { jsx as
|
|
2335
|
+
import { jsx as jsx10, jsxs as jsxs3, Fragment as Fragment3 } from "react/jsx-runtime";
|
|
1900
2336
|
var stripStyleLayers = ({
|
|
1901
2337
|
administrativeBorders,
|
|
1902
2338
|
map,
|
|
@@ -1912,6 +2348,7 @@ var stripStyleLayers = ({
|
|
|
1912
2348
|
};
|
|
1913
2349
|
var mapViewportSchema = {
|
|
1914
2350
|
...Interactive4.baseSchema,
|
|
2351
|
+
...Interactive4.premountSchema,
|
|
1915
2352
|
centerLongitude: {
|
|
1916
2353
|
type: "number",
|
|
1917
2354
|
min: -180,
|
|
@@ -2023,19 +2460,20 @@ var MissingApiKey = () => {
|
|
|
2023
2460
|
textAlign: "center"
|
|
2024
2461
|
},
|
|
2025
2462
|
children: [
|
|
2026
|
-
/* @__PURE__ */
|
|
2463
|
+
/* @__PURE__ */ jsx10("div", {
|
|
2027
2464
|
style: { fontSize: 64, fontWeight: 700 },
|
|
2028
2465
|
children: "MapTiler key needed"
|
|
2029
2466
|
}),
|
|
2030
|
-
/* @__PURE__ */
|
|
2467
|
+
/* @__PURE__ */ jsx10("div", {
|
|
2031
2468
|
style: { fontSize: 32, lineHeight: 1.4, marginTop: 24 },
|
|
2032
2469
|
children: "Pass an apiKey prop to <MapViewport>."
|
|
2033
2470
|
})
|
|
2034
2471
|
]
|
|
2035
2472
|
});
|
|
2036
2473
|
};
|
|
2037
|
-
var
|
|
2474
|
+
var MapViewportContentRefForwardingFunction = ({
|
|
2038
2475
|
apiKey,
|
|
2476
|
+
premountingStyle,
|
|
2039
2477
|
backgroundColor = "#dfe7e2",
|
|
2040
2478
|
bearing = 0,
|
|
2041
2479
|
centerLatitude = 0,
|
|
@@ -2055,20 +2493,12 @@ var MapViewportRefForwardingFunction = ({
|
|
|
2055
2493
|
administrativeBorders = "all",
|
|
2056
2494
|
terrain = false,
|
|
2057
2495
|
terrainExaggeration = 1,
|
|
2058
|
-
|
|
2059
|
-
from,
|
|
2060
|
-
trimBefore,
|
|
2061
|
-
freeze,
|
|
2062
|
-
hidden,
|
|
2063
|
-
name,
|
|
2064
|
-
showInTimeline,
|
|
2065
|
-
zoom = 4,
|
|
2066
|
-
controls
|
|
2496
|
+
zoom = 4
|
|
2067
2497
|
}, ref) => {
|
|
2068
|
-
const mapContainerRef =
|
|
2069
|
-
const mapRef =
|
|
2070
|
-
const viewportRef =
|
|
2071
|
-
const initialCameraRef =
|
|
2498
|
+
const mapContainerRef = useRef11(null);
|
|
2499
|
+
const mapRef = useRef11(null);
|
|
2500
|
+
const viewportRef = useRef11(null);
|
|
2501
|
+
const initialCameraRef = useRef11({
|
|
2072
2502
|
bearing,
|
|
2073
2503
|
centerLatitude,
|
|
2074
2504
|
centerLongitude,
|
|
@@ -2079,7 +2509,7 @@ var MapViewportRefForwardingFunction = ({
|
|
|
2079
2509
|
pitch,
|
|
2080
2510
|
zoom
|
|
2081
2511
|
});
|
|
2082
|
-
const initialMapOptionsRef =
|
|
2512
|
+
const initialMapOptionsRef = useRef11({
|
|
2083
2513
|
administrativeBorders,
|
|
2084
2514
|
language,
|
|
2085
2515
|
mapOptions,
|
|
@@ -2089,21 +2519,21 @@ var MapViewportRefForwardingFunction = ({
|
|
|
2089
2519
|
terrain,
|
|
2090
2520
|
terrainExaggeration
|
|
2091
2521
|
});
|
|
2092
|
-
const lastMapStyleRef =
|
|
2093
|
-
const lastLayerVisibilityRef =
|
|
2522
|
+
const lastMapStyleRef = useRef11(mapStyle);
|
|
2523
|
+
const lastLayerVisibilityRef = useRef11({
|
|
2094
2524
|
administrativeBorders,
|
|
2095
2525
|
showLabels
|
|
2096
2526
|
});
|
|
2097
|
-
const onMapReadyRef =
|
|
2527
|
+
const onMapReadyRef = useRef11(onMapReady);
|
|
2098
2528
|
onMapReadyRef.current = onMapReady;
|
|
2099
2529
|
const { continueRender, delayRender } = useDelayRender9();
|
|
2100
2530
|
const [map, setMap] = useState4(null);
|
|
2101
2531
|
const [cameraRevision, setCameraRevision] = useState4(0);
|
|
2102
2532
|
const [styleRevision, setStyleRevision] = useState4(0);
|
|
2103
2533
|
const [loadingHandle] = useState4(() => delayRender("Loading MapTiler map"));
|
|
2104
|
-
const contextValue =
|
|
2534
|
+
const contextValue = useMemo5(() => ({ cameraRevision, map, styleRevision }), [cameraRevision, map, styleRevision]);
|
|
2105
2535
|
useImperativeHandle4(ref, () => viewportRef.current, []);
|
|
2106
|
-
|
|
2536
|
+
useEffect10(() => {
|
|
2107
2537
|
if (!apiKey) {
|
|
2108
2538
|
continueRender(loadingHandle);
|
|
2109
2539
|
return;
|
|
@@ -2163,7 +2593,7 @@ var MapViewportRefForwardingFunction = ({
|
|
|
2163
2593
|
mapRef.current = null;
|
|
2164
2594
|
};
|
|
2165
2595
|
}, [apiKey, continueRender, loadingHandle]);
|
|
2166
|
-
|
|
2596
|
+
useEffect10(() => {
|
|
2167
2597
|
if (!map) {
|
|
2168
2598
|
return;
|
|
2169
2599
|
}
|
|
@@ -2216,7 +2646,7 @@ var MapViewportRefForwardingFunction = ({
|
|
|
2216
2646
|
pitch,
|
|
2217
2647
|
zoom
|
|
2218
2648
|
]);
|
|
2219
|
-
|
|
2649
|
+
useEffect10(() => {
|
|
2220
2650
|
if (!map || lastMapStyleRef.current === mapStyle && lastLayerVisibilityRef.current.showLabels === showLabels && lastLayerVisibilityRef.current.administrativeBorders === administrativeBorders) {
|
|
2221
2651
|
return;
|
|
2222
2652
|
}
|
|
@@ -2256,13 +2686,13 @@ var MapViewportRefForwardingFunction = ({
|
|
|
2256
2686
|
mapStyle,
|
|
2257
2687
|
showLabels
|
|
2258
2688
|
]);
|
|
2259
|
-
|
|
2689
|
+
useEffect10(() => {
|
|
2260
2690
|
if (map && language) {
|
|
2261
2691
|
map.setLanguage(language);
|
|
2262
2692
|
map.triggerRepaint();
|
|
2263
2693
|
}
|
|
2264
2694
|
}, [language, map]);
|
|
2265
|
-
|
|
2695
|
+
useEffect10(() => {
|
|
2266
2696
|
if (!map) {
|
|
2267
2697
|
return;
|
|
2268
2698
|
}
|
|
@@ -2273,45 +2703,96 @@ var MapViewportRefForwardingFunction = ({
|
|
|
2273
2703
|
}
|
|
2274
2704
|
map.triggerRepaint();
|
|
2275
2705
|
}, [map, terrain, terrainExaggeration]);
|
|
2276
|
-
|
|
2706
|
+
useEffect10(() => {
|
|
2277
2707
|
if (map && projection) {
|
|
2278
2708
|
map.setProjection(projection, { persist: true });
|
|
2279
2709
|
map.triggerRepaint();
|
|
2280
2710
|
}
|
|
2281
2711
|
}, [map, projection]);
|
|
2282
|
-
return /* @__PURE__ */
|
|
2283
|
-
|
|
2712
|
+
return /* @__PURE__ */ jsx10("div", {
|
|
2713
|
+
ref: viewportRef,
|
|
2714
|
+
style: {
|
|
2715
|
+
backgroundColor,
|
|
2716
|
+
inset: 0,
|
|
2717
|
+
overflow: "hidden",
|
|
2718
|
+
position: "absolute",
|
|
2719
|
+
...premountingStyle
|
|
2720
|
+
},
|
|
2721
|
+
children: apiKey ? /* @__PURE__ */ jsxs3(Fragment3, {
|
|
2722
|
+
children: [
|
|
2723
|
+
/* @__PURE__ */ jsx10("div", {
|
|
2724
|
+
ref: mapContainerRef,
|
|
2725
|
+
style: {
|
|
2726
|
+
inset: 0,
|
|
2727
|
+
position: "absolute"
|
|
2728
|
+
}
|
|
2729
|
+
}),
|
|
2730
|
+
/* @__PURE__ */ jsx10(MapTilerContext.Provider, {
|
|
2731
|
+
value: contextValue,
|
|
2732
|
+
children
|
|
2733
|
+
})
|
|
2734
|
+
]
|
|
2735
|
+
}) : /* @__PURE__ */ jsx10(MissingApiKey, {})
|
|
2736
|
+
});
|
|
2737
|
+
};
|
|
2738
|
+
var MapViewportContent = forwardRef4(MapViewportContentRefForwardingFunction);
|
|
2739
|
+
var MapViewportRefForwardingFunction = ({
|
|
2740
|
+
durationInFrames,
|
|
2741
|
+
from,
|
|
2742
|
+
trimBefore,
|
|
2743
|
+
playbackRate,
|
|
2744
|
+
freeze,
|
|
2745
|
+
hidden,
|
|
2746
|
+
name,
|
|
2747
|
+
showInTimeline,
|
|
2748
|
+
controls,
|
|
2749
|
+
premountFor,
|
|
2750
|
+
postmountFor,
|
|
2751
|
+
styleWhilePremounted,
|
|
2752
|
+
styleWhilePostmounted,
|
|
2753
|
+
...props
|
|
2754
|
+
}, ref) => {
|
|
2755
|
+
const {
|
|
2756
|
+
effectivePremountFor,
|
|
2757
|
+
effectivePostmountFor,
|
|
2758
|
+
freezeFrame,
|
|
2759
|
+
isPremountingOrPostmounting,
|
|
2760
|
+
premountingActive,
|
|
2761
|
+
postmountingActive,
|
|
2762
|
+
premountingStyle
|
|
2763
|
+
} = Internals11.usePremounting({
|
|
2284
2764
|
from: from ?? 0,
|
|
2285
|
-
trimBefore,
|
|
2286
2765
|
durationInFrames: durationInFrames ?? Infinity,
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2766
|
+
premountFor: premountFor ?? null,
|
|
2767
|
+
postmountFor: postmountFor ?? null,
|
|
2768
|
+
style: null,
|
|
2769
|
+
styleWhilePremounted: styleWhilePremounted ?? null,
|
|
2770
|
+
styleWhilePostmounted: styleWhilePostmounted ?? null,
|
|
2771
|
+
hideWhilePremounted: "opacity"
|
|
2772
|
+
});
|
|
2773
|
+
return /* @__PURE__ */ jsx10(Freeze10, {
|
|
2774
|
+
frame: freezeFrame,
|
|
2775
|
+
active: isPremountingOrPostmounting,
|
|
2776
|
+
children: /* @__PURE__ */ jsx10(Sequence10, {
|
|
2777
|
+
layout: "none",
|
|
2778
|
+
durationInFrames,
|
|
2779
|
+
from,
|
|
2780
|
+
trimBefore,
|
|
2781
|
+
playbackRate,
|
|
2782
|
+
freeze,
|
|
2783
|
+
hidden,
|
|
2784
|
+
showInTimeline,
|
|
2785
|
+
controls,
|
|
2786
|
+
name: name ?? "<MapViewport>",
|
|
2787
|
+
_remotionInternalPremountDisplay: effectivePremountFor || null,
|
|
2788
|
+
_remotionInternalPostmountDisplay: effectivePostmountFor || null,
|
|
2789
|
+
_remotionInternalIsPremounting: premountingActive,
|
|
2790
|
+
_remotionInternalIsPostmounting: postmountingActive,
|
|
2791
|
+
children: /* @__PURE__ */ jsx10(MapViewportContent, {
|
|
2792
|
+
...props,
|
|
2793
|
+
ref,
|
|
2794
|
+
premountingStyle
|
|
2795
|
+
})
|
|
2315
2796
|
})
|
|
2316
2797
|
});
|
|
2317
2798
|
};
|