@classic-homes/maps-svelte 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import 'maplibre-gl/dist/maplibre-gl.css';
|
|
3
3
|
import '@classic-homes/maps-core/styles/controls.css';
|
|
4
|
+
import '@classic-homes/maps-core/styles/marker.css';
|
|
4
5
|
import type { MapProps } from '@classic-homes/maps-core';
|
|
5
6
|
interface Props extends Omit<MapProps, 'class'> {
|
|
6
7
|
class?: string;
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import maplibregl from 'maplibre-gl';
|
|
5
5
|
import type { MarkerProps, LngLat } from '@classic-homes/maps-core';
|
|
6
|
+
import {
|
|
7
|
+
applyMarkerProtection,
|
|
8
|
+
applyMarkerChildProtection,
|
|
9
|
+
removeMarkerProtection,
|
|
10
|
+
} from '@classic-homes/maps-core';
|
|
6
11
|
|
|
7
12
|
type Anchor =
|
|
8
13
|
| 'center'
|
|
@@ -84,6 +89,15 @@
|
|
|
84
89
|
.setLngLat(coordinates as [number, number])
|
|
85
90
|
.addTo(map);
|
|
86
91
|
|
|
92
|
+
// Protect against CSS framework interference that causes marker sliding
|
|
93
|
+
const el = newMarker.getElement();
|
|
94
|
+
applyMarkerProtection(el);
|
|
95
|
+
|
|
96
|
+
// Also protect custom content element if present
|
|
97
|
+
if (children && markerElement) {
|
|
98
|
+
applyMarkerChildProtection(markerElement);
|
|
99
|
+
}
|
|
100
|
+
|
|
87
101
|
marker = newMarker;
|
|
88
102
|
|
|
89
103
|
// Click handler
|
|
@@ -172,6 +186,8 @@
|
|
|
172
186
|
marker.getElement().removeEventListener('click', clickHandler);
|
|
173
187
|
clickHandler = null;
|
|
174
188
|
}
|
|
189
|
+
// Clean up marker protection observer
|
|
190
|
+
removeMarkerProtection(marker.getElement());
|
|
175
191
|
marker.remove();
|
|
176
192
|
marker = null;
|
|
177
193
|
}
|