@tellegen/svelte 0.4.5 → 0.4.6
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/TellegenMap.svelte +21 -8
- package/package.json +1 -1
package/dist/TellegenMap.svelte
CHANGED
|
@@ -844,17 +844,26 @@
|
|
|
844
844
|
// maplibre's own WebGL2 context instead of a second canvas, so the page
|
|
845
845
|
// holds one GL context rather than two. Safari evicts WebGL contexts under
|
|
846
846
|
// memory and tab pressure, and one context survives that far better; the
|
|
847
|
-
// deck layers also inherit maplibre's 4096 canvas clamp. The flat
|
|
848
|
-
//
|
|
849
|
-
|
|
847
|
+
// deck layers also inherit maplibre's 4096 canvas clamp. The flat basemap
|
|
848
|
+
// writes no depth, so on the flat map the overlay always draws on top. On
|
|
849
|
+
// the globe it tests against the depth maplibre writes for the earth, so a
|
|
850
|
+
// network on the far hemisphere hides behind it instead of showing through.
|
|
851
|
+
function overlayParameters(type: MapProjection) {
|
|
852
|
+
return {
|
|
853
|
+
depthWriteEnabled: false,
|
|
854
|
+
depthCompare: type === 'globe' ? ('less-equal' as const) : ('always' as const)
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
function buildOverlay(
|
|
859
|
+
MapLibreOverlay: MapModules['MapLibreOverlay'],
|
|
860
|
+
type: MapProjection
|
|
861
|
+
): MapLibreOverlay {
|
|
850
862
|
const touch = coarsePointer();
|
|
851
863
|
return new MapLibreOverlay({
|
|
852
864
|
interleaved: true,
|
|
853
865
|
layers: [],
|
|
854
|
-
parameters:
|
|
855
|
-
depthWriteEnabled: false,
|
|
856
|
-
depthCompare: 'always'
|
|
857
|
-
},
|
|
866
|
+
parameters: overlayParameters(type),
|
|
858
867
|
// a small bus draws ~9px across, well under a fingertip
|
|
859
868
|
pickingRadius: touch ? 12 : 0,
|
|
860
869
|
onClick: (info: PickingInfo) => {
|
|
@@ -915,7 +924,10 @@
|
|
|
915
924
|
onFallback: (reason) => onBasemapFallback?.(reason),
|
|
916
925
|
onFailure: (reason) => onBasemapError?.(reason)
|
|
917
926
|
});
|
|
918
|
-
const o = buildOverlay(
|
|
927
|
+
const o = buildOverlay(
|
|
928
|
+
MapLibreOverlay,
|
|
929
|
+
untrack(() => projection)
|
|
930
|
+
);
|
|
919
931
|
m.addControl(o);
|
|
920
932
|
m.on('click', (e) => {
|
|
921
933
|
if (app.placingId) onplacecase(e.lngLat.lng, e.lngLat.lat);
|
|
@@ -1057,6 +1069,7 @@
|
|
|
1057
1069
|
// MapLibre throws, and the `style.load` handler above applies it instead.
|
|
1058
1070
|
$effect(() => {
|
|
1059
1071
|
const type = projection;
|
|
1072
|
+
overlay?.setProps({ parameters: overlayParameters(type) });
|
|
1060
1073
|
const m = map;
|
|
1061
1074
|
if (!m) return;
|
|
1062
1075
|
try {
|