@radiofrance/svelte-leaflet 0.1.0-alpha.7 → 0.1.0-alpha.9
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/Circle.svelte +25 -10
- package/dist/Circle.svelte.d.ts +16 -2
- package/dist/Map.svelte +46 -12
- package/dist/Map.svelte.d.ts +38 -38
- package/dist/MarkerClusterGroup.svelte +35 -5
- package/dist/MarkerClusterGroup.svelte.d.ts +2 -0
- package/dist/index.d.ts +48 -1
- package/dist/index.js +51 -0
- package/package.json +1 -1
package/dist/Circle.svelte
CHANGED
|
@@ -1,25 +1,40 @@
|
|
|
1
1
|
<script>import { createEventDispatcher, getContext, onDestroy, onMount } from "svelte";
|
|
2
|
+
import {
|
|
3
|
+
bindEvents,
|
|
4
|
+
interactiveLayerEvents,
|
|
5
|
+
layerEvents,
|
|
6
|
+
popupEvents,
|
|
7
|
+
tooltipEvents
|
|
8
|
+
} from "./index.js";
|
|
2
9
|
export let center;
|
|
3
10
|
export let options = { radius: 100 };
|
|
4
|
-
let
|
|
11
|
+
export let instance = void 0;
|
|
12
|
+
const events = [
|
|
13
|
+
"move",
|
|
14
|
+
...interactiveLayerEvents,
|
|
15
|
+
...layerEvents,
|
|
16
|
+
...popupEvents,
|
|
17
|
+
...tooltipEvents
|
|
18
|
+
];
|
|
5
19
|
let map = getContext("map")();
|
|
6
20
|
const dispatch = createEventDispatcher();
|
|
7
21
|
$:
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
|
|
22
|
+
updateCircle(center, options);
|
|
23
|
+
function updateCircle(center2, options2) {
|
|
24
|
+
if (instance) {
|
|
25
|
+
instance.setLatLng(center2);
|
|
26
|
+
instance.setStyle(options2);
|
|
27
|
+
instance.setRadius(options2.radius);
|
|
13
28
|
}
|
|
14
29
|
}
|
|
15
30
|
onMount(async () => {
|
|
16
31
|
const L = window.L;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
32
|
+
instance = new L.Circle(center, options);
|
|
33
|
+
bindEvents(instance, dispatch, events);
|
|
34
|
+
instance.addTo(map);
|
|
20
35
|
});
|
|
21
36
|
onDestroy(() => {
|
|
22
|
-
|
|
37
|
+
instance?.remove();
|
|
23
38
|
});
|
|
24
39
|
</script>
|
|
25
40
|
|
package/dist/Circle.svelte.d.ts
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import type { LatLngExpression } from 'leaflet';
|
|
2
|
+
import type { Circle as LeafletCircle, LatLngExpression } from 'leaflet';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
center: LatLngExpression;
|
|
6
6
|
options?: import("leaflet").CircleMarkerOptions | undefined;
|
|
7
|
+
instance?: LeafletCircle | undefined;
|
|
7
8
|
};
|
|
8
9
|
events: {
|
|
9
|
-
click: CustomEvent<
|
|
10
|
+
click: CustomEvent<import("leaflet").LeafletMouseEvent>;
|
|
11
|
+
dblclick: CustomEvent<import("leaflet").LeafletMouseEvent>;
|
|
12
|
+
mousedown: CustomEvent<import("leaflet").LeafletMouseEvent>;
|
|
13
|
+
mouseup: CustomEvent<import("leaflet").LeafletMouseEvent>;
|
|
14
|
+
mouseover: CustomEvent<import("leaflet").LeafletMouseEvent>;
|
|
15
|
+
mouseout: CustomEvent<import("leaflet").LeafletMouseEvent>;
|
|
16
|
+
contextmenu: CustomEvent<import("leaflet").LeafletMouseEvent>;
|
|
17
|
+
move: CustomEvent<import("leaflet").LeafletEvent>;
|
|
18
|
+
popupopen: CustomEvent<import("leaflet").PopupEvent>;
|
|
19
|
+
popupclose: CustomEvent<import("leaflet").PopupEvent>;
|
|
20
|
+
tooltipopen: CustomEvent<import("leaflet").TooltipEvent>;
|
|
21
|
+
tooltipclose: CustomEvent<import("leaflet").TooltipEvent>;
|
|
22
|
+
add: CustomEvent<import("leaflet").LeafletEvent>;
|
|
23
|
+
remove: CustomEvent<import("leaflet").LeafletEvent>;
|
|
10
24
|
} & {
|
|
11
25
|
[evt: string]: CustomEvent<any>;
|
|
12
26
|
};
|
package/dist/Map.svelte
CHANGED
|
@@ -1,38 +1,72 @@
|
|
|
1
1
|
<script>import "leaflet/dist/leaflet.css";
|
|
2
2
|
import "leaflet.markercluster/dist/MarkerCluster.css";
|
|
3
3
|
import "leaflet.markercluster/dist/MarkerCluster.Default.css";
|
|
4
|
+
import markerIcon2x from "leaflet/dist/images/marker-icon-2x.png";
|
|
5
|
+
import markerIcon from "leaflet/dist/images/marker-icon.png";
|
|
6
|
+
import markerShadow from "leaflet/dist/images/marker-shadow.png";
|
|
4
7
|
import { createEventDispatcher, setContext } from "svelte";
|
|
8
|
+
import {
|
|
9
|
+
bindEvents,
|
|
10
|
+
keyboardEvents,
|
|
11
|
+
layerGroupEvents,
|
|
12
|
+
layersControlEvents,
|
|
13
|
+
leafletMouseEvents,
|
|
14
|
+
locationEvents,
|
|
15
|
+
mapStateChangeEvents,
|
|
16
|
+
popupEvents,
|
|
17
|
+
tooltipEvents
|
|
18
|
+
} from "./index.js";
|
|
5
19
|
let L;
|
|
6
20
|
export let options = {};
|
|
7
21
|
export let tilesUrl = "https://tile.openstreetmap.org/{z}/{x}/{y}.png";
|
|
8
22
|
export let attribution = `©<a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>`;
|
|
23
|
+
export let instance = null;
|
|
9
24
|
const dispatch = createEventDispatcher();
|
|
10
|
-
let thisMap;
|
|
11
25
|
export const getMarkers = () => {
|
|
12
26
|
const markers = [];
|
|
13
|
-
|
|
27
|
+
instance?.eachLayer((layer) => {
|
|
14
28
|
if (layer instanceof L.Marker) {
|
|
15
29
|
markers.push(layer);
|
|
16
30
|
}
|
|
17
31
|
});
|
|
18
32
|
return markers;
|
|
19
33
|
};
|
|
20
|
-
|
|
21
|
-
setContext("map", () => thisMap);
|
|
34
|
+
setContext("map", () => instance);
|
|
22
35
|
let container;
|
|
23
36
|
$:
|
|
24
|
-
if (
|
|
25
|
-
|
|
37
|
+
if (instance)
|
|
38
|
+
instance.options = Object.assign(instance.options, options);
|
|
26
39
|
function resizeMap() {
|
|
27
|
-
|
|
40
|
+
instance?.invalidateSize();
|
|
28
41
|
}
|
|
42
|
+
const events = [
|
|
43
|
+
...keyboardEvents,
|
|
44
|
+
...layerGroupEvents,
|
|
45
|
+
...layersControlEvents,
|
|
46
|
+
...leafletMouseEvents,
|
|
47
|
+
...locationEvents,
|
|
48
|
+
...mapStateChangeEvents,
|
|
49
|
+
...popupEvents,
|
|
50
|
+
...tooltipEvents,
|
|
51
|
+
"autopanstart",
|
|
52
|
+
"zoomanim"
|
|
53
|
+
];
|
|
29
54
|
function onLoad() {
|
|
30
55
|
L = window.L;
|
|
31
|
-
|
|
56
|
+
delete L.Icon.Default.prototype._getIconUrl;
|
|
57
|
+
L.Icon.Default.mergeOptions({
|
|
58
|
+
iconRetinaUrl: markerIcon2x,
|
|
59
|
+
iconUrl: markerIcon,
|
|
60
|
+
shadowUrl: markerShadow
|
|
61
|
+
});
|
|
62
|
+
instance = L.map(container, { maxZoom: 18, ...options });
|
|
63
|
+
bindEvents(instance, dispatch, events);
|
|
32
64
|
L.tileLayer(tilesUrl, {
|
|
33
65
|
attribution
|
|
34
|
-
|
|
35
|
-
|
|
66
|
+
}).addTo(instance);
|
|
67
|
+
instance.whenReady(() => {
|
|
68
|
+
instance.fireEvent("load");
|
|
69
|
+
});
|
|
36
70
|
}
|
|
37
71
|
function leafletLoader(_node) {
|
|
38
72
|
import("leaflet").then(() => {
|
|
@@ -44,7 +78,7 @@ function leafletLoader(_node) {
|
|
|
44
78
|
<svelte:window on:resize={resizeMap} use:leafletLoader />
|
|
45
79
|
|
|
46
80
|
<div class="Map" bind:this={container} style="height: 100%; width: 100%">
|
|
47
|
-
{#if
|
|
48
|
-
<slot map={
|
|
81
|
+
{#if instance}
|
|
82
|
+
<slot map={instance} />
|
|
49
83
|
{/if}
|
|
50
84
|
</div>
|
package/dist/Map.svelte.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type { MapOptions, Marker, Map } from 'leaflet';
|
|
3
|
+
import type Leaflet from 'leaflet';
|
|
3
4
|
import 'leaflet/dist/leaflet.css';
|
|
4
5
|
import 'leaflet.markercluster/dist/MarkerCluster.css';
|
|
5
6
|
import 'leaflet.markercluster/dist/MarkerCluster.Default.css';
|
|
@@ -8,46 +9,46 @@ declare const __propDef: {
|
|
|
8
9
|
options?: MapOptions | undefined;
|
|
9
10
|
tilesUrl?: string | undefined;
|
|
10
11
|
attribution?: string | undefined;
|
|
12
|
+
instance?: Map | undefined;
|
|
11
13
|
getMarkers?: (() => Marker[]) | undefined;
|
|
12
|
-
map?: (() => Map) | undefined;
|
|
13
14
|
};
|
|
14
15
|
events: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
layeradd: CustomEvent<
|
|
19
|
-
layerremove: CustomEvent<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
zoomanim: CustomEvent<
|
|
16
|
+
keypress: CustomEvent<Leaflet.LeafletKeyboardEvent>;
|
|
17
|
+
keydown: CustomEvent<Leaflet.LeafletKeyboardEvent>;
|
|
18
|
+
keyup: CustomEvent<Leaflet.LeafletKeyboardEvent>;
|
|
19
|
+
layeradd: CustomEvent<Leaflet.LayerEvent>;
|
|
20
|
+
layerremove: CustomEvent<Leaflet.LayerEvent>;
|
|
21
|
+
baselayerchange: CustomEvent<Leaflet.LayersControlEvent>;
|
|
22
|
+
overlayadd: CustomEvent<Leaflet.LayersControlEvent>;
|
|
23
|
+
overlayremove: CustomEvent<Leaflet.LayersControlEvent>;
|
|
24
|
+
click: CustomEvent<Leaflet.LeafletMouseEvent>;
|
|
25
|
+
dblclick: CustomEvent<Leaflet.LeafletMouseEvent>;
|
|
26
|
+
mousedown: CustomEvent<Leaflet.LeafletMouseEvent>;
|
|
27
|
+
mouseup: CustomEvent<Leaflet.LeafletMouseEvent>;
|
|
28
|
+
mouseover: CustomEvent<Leaflet.LeafletMouseEvent>;
|
|
29
|
+
mouseout: CustomEvent<Leaflet.LeafletMouseEvent>;
|
|
30
|
+
contextmenu: CustomEvent<Leaflet.LeafletMouseEvent>;
|
|
31
|
+
mousemove: CustomEvent<Leaflet.LeafletMouseEvent>;
|
|
32
|
+
preclick: CustomEvent<Leaflet.LeafletMouseEvent>;
|
|
33
|
+
locationfound: CustomEvent<Leaflet.LocationEvent>;
|
|
34
|
+
locationerror: CustomEvent<Leaflet.ErrorEvent>;
|
|
35
|
+
load: CustomEvent<Leaflet.LeafletEvent>;
|
|
36
|
+
move: CustomEvent<Leaflet.LeafletEvent>;
|
|
37
|
+
moveend: CustomEvent<Leaflet.LeafletEvent>;
|
|
38
|
+
movestart: CustomEvent<Leaflet.LeafletEvent>;
|
|
39
|
+
unload: CustomEvent<Leaflet.LeafletEvent>;
|
|
40
|
+
viewreset: CustomEvent<Leaflet.LeafletEvent>;
|
|
41
|
+
zoom: CustomEvent<Leaflet.LeafletEvent>;
|
|
42
|
+
zoomend: CustomEvent<Leaflet.LeafletEvent>;
|
|
43
|
+
zoomlevelschange: CustomEvent<Leaflet.LeafletEvent>;
|
|
44
|
+
zoomstart: CustomEvent<Leaflet.LeafletEvent>;
|
|
45
|
+
resize: CustomEvent<Leaflet.ResizeEvent>;
|
|
46
|
+
popupopen: CustomEvent<Leaflet.PopupEvent>;
|
|
47
|
+
popupclose: CustomEvent<Leaflet.PopupEvent>;
|
|
48
|
+
tooltipopen: CustomEvent<Leaflet.TooltipEvent>;
|
|
49
|
+
tooltipclose: CustomEvent<Leaflet.TooltipEvent>;
|
|
50
|
+
autopanstart: CustomEvent<Leaflet.LeafletEvent>;
|
|
51
|
+
zoomanim: CustomEvent<Leaflet.LeafletEvent>;
|
|
51
52
|
} & {
|
|
52
53
|
[evt: string]: CustomEvent<any>;
|
|
53
54
|
};
|
|
@@ -62,6 +63,5 @@ export type MapEvents = typeof __propDef.events;
|
|
|
62
63
|
export type MapSlots = typeof __propDef.slots;
|
|
63
64
|
export default class Map extends SvelteComponent<MapProps, MapEvents, MapSlots> {
|
|
64
65
|
get getMarkers(): () => Marker<any>[];
|
|
65
|
-
get map(): () => Map;
|
|
66
66
|
}
|
|
67
67
|
export {};
|
|
@@ -1,14 +1,44 @@
|
|
|
1
|
-
<script>import { getContext, onMount, setContext } from "svelte";
|
|
1
|
+
<script>import { getContext, onMount, setContext, tick } from "svelte";
|
|
2
2
|
export let options = {};
|
|
3
|
+
export let icon = null;
|
|
4
|
+
let markerElement;
|
|
3
5
|
const L = globalThis.window.L;
|
|
4
6
|
const getMap = getContext("map");
|
|
5
|
-
let
|
|
6
|
-
setContext("layerGroup", () =>
|
|
7
|
+
let clusterGroup;
|
|
8
|
+
setContext("layerGroup", () => clusterGroup);
|
|
7
9
|
onMount(async () => {
|
|
8
10
|
const map = getMap();
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
if (icon) {
|
|
12
|
+
options.iconCreateFunction = function(cluster) {
|
|
13
|
+
const html = document.createElement("div");
|
|
14
|
+
new icon({ target: html, props: { count: cluster.getChildCount() } });
|
|
15
|
+
return L.divIcon({ html, className: "foobar" });
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
if (markerElement.childElementCount > 0) {
|
|
19
|
+
options.iconCreateFunction = function(cluster) {
|
|
20
|
+
const html = markerElement.innerHTML.replace("%count%", cluster.getChildCount().toString());
|
|
21
|
+
return L.divIcon({ html, className: "" });
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
clusterGroup = L.markerClusterGroup(options);
|
|
25
|
+
map.addLayer(clusterGroup);
|
|
11
26
|
});
|
|
12
27
|
</script>
|
|
13
28
|
|
|
14
29
|
<slot />
|
|
30
|
+
<template>
|
|
31
|
+
<div bind:this={markerElement} class="leaflet-markercluster">
|
|
32
|
+
<slot name="icon" />
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<style>
|
|
37
|
+
.leaflet-markercluster {
|
|
38
|
+
display: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:global(.map-marker .leaflet-markercluster) {
|
|
42
|
+
display: inherit;
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
@@ -3,12 +3,14 @@ import type { MarkerClusterGroupOptions } from 'leaflet';
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
options?: MarkerClusterGroupOptions | undefined;
|
|
6
|
+
icon?: any;
|
|
6
7
|
};
|
|
7
8
|
events: {
|
|
8
9
|
[evt: string]: CustomEvent<any>;
|
|
9
10
|
};
|
|
10
11
|
slots: {
|
|
11
12
|
default: {};
|
|
13
|
+
icon: {};
|
|
12
14
|
};
|
|
13
15
|
};
|
|
14
16
|
export type MarkerClusterGroupProps = typeof __propDef.props;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,54 @@
|
|
|
1
|
+
import type { DragEndEvent, ErrorEvent, Evented, LayerEvent, LayersControlEvent, LeafletEvent, LeafletKeyboardEvent, LeafletMouseEvent, LocationEvent, PopupEvent, ResizeEvent, TooltipEvent } from 'leaflet';
|
|
2
|
+
import type { EventDispatcher } from 'svelte';
|
|
1
3
|
export { default as Map } from './Map.svelte';
|
|
2
4
|
export { default as Marker } from './Marker.svelte';
|
|
3
5
|
export { default as MarkerClusterGroup } from './MarkerClusterGroup.svelte';
|
|
4
6
|
export { default as Polyline } from './Polyline.svelte';
|
|
5
7
|
export { default as Popup } from './Popup.svelte';
|
|
8
|
+
export { default as Circle } from './Circle.svelte';
|
|
6
9
|
export type { Marker as LeafletMarker } from './Marker.svelte';
|
|
7
|
-
export type { CircleOptions, LatLngExpression, LatLngLiteral, LatLngTuple, LeafletEvent, LeafletKeyboardEvent, LeafletMouseEvent, Map as LeafletMap, MapOptions, MarkerOptions, PathOptions } from 'leaflet';
|
|
10
|
+
export type { Circle as LeafletCircle, CircleOptions, DragEndEvent, ErrorEvent, LatLngExpression, LatLngLiteral, LatLngTuple, LayerEvent, LayersControlEvent, LeafletEvent, LeafletKeyboardEvent, LeafletMouseEvent, LocationEvent, Map as LeafletMap, MapOptions, MarkerOptions, PathOptions, PopupEvent, PopupOptions, ResizeEvent, TooltipEvent } from 'leaflet';
|
|
11
|
+
export declare function bindEvents(instance: Evented, dispatch: EventDispatcher<Record<string, unknown>>, events: readonly string[]): void;
|
|
12
|
+
export declare const interactiveLayerEvents: readonly ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mouseout", "contextmenu"];
|
|
13
|
+
export declare const keyboardEvents: readonly ["keypress", "keydown", "keyup"];
|
|
14
|
+
export declare const locationEvents: readonly ["locationfound", "locationerror"];
|
|
15
|
+
export declare const leafletMouseEvents: readonly ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mouseout", "contextmenu", "mousemove", "preclick"];
|
|
16
|
+
export declare const layerEvents: readonly ["add", "remove"];
|
|
17
|
+
export declare const popupEvents: readonly ["popupopen", "popupclose"];
|
|
18
|
+
export declare const tooltipEvents: readonly ["tooltipopen", "tooltipclose"];
|
|
19
|
+
export declare const layerGroupEvents: readonly ["layeradd", "layerremove"];
|
|
20
|
+
export declare const layersControlEvents: readonly ["baselayerchange", "overlayadd", "overlayremove"];
|
|
21
|
+
declare const leafletEvents: readonly ["load", "move", "moveend", "movestart", "unload", "viewreset", "zoom", "zoomend", "zoomlevelschange", "zoomstart"];
|
|
22
|
+
export declare const mapStateChangeEvents: readonly ["load", "move", "moveend", "movestart", "unload", "viewreset", "zoom", "zoomend", "zoomlevelschange", "zoomstart", "resize"];
|
|
23
|
+
type LeafletEventTypes = {
|
|
24
|
+
resize: ResizeEvent;
|
|
25
|
+
locationerror: ErrorEvent;
|
|
26
|
+
locationfound: LocationEvent;
|
|
27
|
+
add: LeafletEvent;
|
|
28
|
+
remove: LeafletEvent;
|
|
29
|
+
dragend: DragEndEvent;
|
|
30
|
+
} & LeafletEvents & LayersControlEvents & MouseEvents & PopupEvents & TooltipEvents & LayerGroupEvents & KeyboardEvents;
|
|
31
|
+
type LeafletEvents = {
|
|
32
|
+
[K in (typeof leafletEvents)[number]]: LeafletEvent;
|
|
33
|
+
};
|
|
34
|
+
type LayersControlEvents = {
|
|
35
|
+
[K in (typeof layersControlEvents)[number]]: LayersControlEvent;
|
|
36
|
+
};
|
|
37
|
+
type MouseEvents = {
|
|
38
|
+
[K in (typeof leafletMouseEvents)[number]]: LeafletMouseEvent;
|
|
39
|
+
};
|
|
40
|
+
type PopupEvents = {
|
|
41
|
+
[K in (typeof popupEvents)[number]]: PopupEvent;
|
|
42
|
+
};
|
|
43
|
+
type TooltipEvents = {
|
|
44
|
+
[K in (typeof tooltipEvents)[number]]: TooltipEvent;
|
|
45
|
+
};
|
|
46
|
+
type LayerGroupEvents = {
|
|
47
|
+
[K in (typeof layerGroupEvents)[number]]: LayerEvent;
|
|
48
|
+
};
|
|
49
|
+
type KeyboardEvents = {
|
|
50
|
+
[K in (typeof keyboardEvents)[number]]: LeafletKeyboardEvent;
|
|
51
|
+
};
|
|
52
|
+
export type LeafletEventsRecord<T extends readonly string[]> = {
|
|
53
|
+
[K in T[number]]: K extends keyof LeafletEventTypes ? LeafletEventTypes[K] : LeafletEvent;
|
|
54
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -4,3 +4,54 @@ export { default as Marker } from './Marker.svelte';
|
|
|
4
4
|
export { default as MarkerClusterGroup } from './MarkerClusterGroup.svelte';
|
|
5
5
|
export { default as Polyline } from './Polyline.svelte';
|
|
6
6
|
export { default as Popup } from './Popup.svelte';
|
|
7
|
+
export { default as Circle } from './Circle.svelte';
|
|
8
|
+
export function bindEvents(instance, dispatch, events) {
|
|
9
|
+
events.forEach((event) => {
|
|
10
|
+
instance.on(event, (e) => dispatch(event, e));
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
// export const leafletEvents = [
|
|
14
|
+
// 'dragstart',
|
|
15
|
+
// 'drag',
|
|
16
|
+
// 'add',
|
|
17
|
+
// 'remove',
|
|
18
|
+
// 'loading',
|
|
19
|
+
// 'error',
|
|
20
|
+
// 'update',
|
|
21
|
+
// 'down',
|
|
22
|
+
// 'predrag'
|
|
23
|
+
// ] as const;
|
|
24
|
+
// export const resizeEvents = ['resize'] as const;
|
|
25
|
+
// export const zoomAnimEvents = ['zoomanim'] as const;
|
|
26
|
+
// export const tileEvents = ['tileunload', 'tileloadstart', 'tileload', 'tileabort'] as const;
|
|
27
|
+
// export const tileErrorEvents = ['tileerror'] as const;
|
|
28
|
+
export const interactiveLayerEvents = [
|
|
29
|
+
'click',
|
|
30
|
+
'dblclick',
|
|
31
|
+
'mousedown',
|
|
32
|
+
'mouseup',
|
|
33
|
+
'mouseover',
|
|
34
|
+
'mouseout',
|
|
35
|
+
'contextmenu'
|
|
36
|
+
];
|
|
37
|
+
export const keyboardEvents = ['keypress', 'keydown', 'keyup'];
|
|
38
|
+
export const locationEvents = ['locationfound', 'locationerror'];
|
|
39
|
+
export const leafletMouseEvents = [...interactiveLayerEvents, 'mousemove', 'preclick'];
|
|
40
|
+
export const layerEvents = ['add', 'remove'];
|
|
41
|
+
export const popupEvents = ['popupopen', 'popupclose'];
|
|
42
|
+
export const tooltipEvents = ['tooltipopen', 'tooltipclose'];
|
|
43
|
+
export const layerGroupEvents = ['layeradd', 'layerremove'];
|
|
44
|
+
export const layersControlEvents = ['baselayerchange', 'overlayadd', 'overlayremove'];
|
|
45
|
+
const leafletEvents = [
|
|
46
|
+
'load',
|
|
47
|
+
'move',
|
|
48
|
+
'moveend',
|
|
49
|
+
'movestart',
|
|
50
|
+
'unload',
|
|
51
|
+
'viewreset',
|
|
52
|
+
'zoom',
|
|
53
|
+
'zoomend',
|
|
54
|
+
'zoomlevelschange',
|
|
55
|
+
'zoomstart'
|
|
56
|
+
];
|
|
57
|
+
export const mapStateChangeEvents = [...leafletEvents, 'resize'];
|