@summeruse/ol 0.3.2 → 0.4.0
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/CHANGELOG.md +19 -0
- package/README.md +70 -8
- package/dist/index.d.ts +665 -0
- package/dist/index.iife.min.js +4 -0
- package/dist/index.js +9930 -554
- package/package.json +13 -18
- package/es/components/index.d.ts +0 -1
- package/es/components/index.mjs +0 -3
- package/es/components/ol-map/index.d.ts +0 -4
- package/es/components/ol-map/index.mjs +0 -3
- package/es/components/ol-map/index.test.d.ts +0 -1
- package/es/components/ol-map/index.vue.d.ts +0 -59
- package/es/components/ol-map/index.vue_vue_type_script_setup_true_lang.mjs +0 -151
- package/es/components/ol-map/index2.mjs +0 -2
- package/es/components/ol-map/props.d.ts +0 -38
- package/es/components/ol-map/props.mjs +0 -6
- package/es/composables/common/index.d.ts +0 -1
- package/es/composables/common/index.mjs +0 -5
- package/es/composables/index.d.ts +0 -6
- package/es/composables/index.mjs +0 -6
- package/es/composables/useContextmenu/index.d.ts +0 -71
- package/es/composables/useContextmenu/index.mjs +0 -71
- package/es/composables/useDrawLineString/index.d.ts +0 -109
- package/es/composables/useDrawLineString/index.mjs +0 -105
- package/es/composables/useDrawPolygon/index.d.ts +0 -109
- package/es/composables/useDrawPolygon/index.mjs +0 -106
- package/es/composables/useGraticule/index.d.ts +0 -20
- package/es/composables/useGraticule/index.mjs +0 -23
- package/es/composables/usePointermove/index.d.ts +0 -70
- package/es/composables/usePointermove/index.mjs +0 -91
- package/es/composables/useSwitchBaseLayer/index.d.ts +0 -11
- package/es/composables/useSwitchBaseLayer/index.mjs +0 -17
- package/es/constants/distance.d.ts +0 -1
- package/es/constants/distance.mjs +0 -2
- package/es/constants/index.d.ts +0 -2
- package/es/constants/projection.d.ts +0 -9
- package/es/constants/projection.mjs +0 -2
- package/es/index.d.ts +0 -4
- package/es/index.mjs +0 -19
- package/es/types/index.d.ts +0 -4
- package/es/utils/distance/index.d.ts +0 -8
- package/es/utils/distance/index.mjs +0 -14
- package/es/utils/feature/index.d.ts +0 -26
- package/es/utils/feature/index.mjs +0 -81
- package/es/utils/index.d.ts +0 -5
- package/es/utils/index.mjs +0 -5
- package/es/utils/layer/index.d.ts +0 -60
- package/es/utils/layer/index.mjs +0 -70
- package/es/utils/projection/index.d.ts +0 -18
- package/es/utils/projection/index.mjs +0 -19
- package/es/utils/style/index.d.ts +0 -27
- package/es/utils/style/index.mjs +0 -30
- package/lib/_virtual/rolldown_runtime.js +0 -1
- package/lib/components/index.d.ts +0 -1
- package/lib/components/index.js +0 -1
- package/lib/components/ol-map/index.d.ts +0 -4
- package/lib/components/ol-map/index.js +0 -1
- package/lib/components/ol-map/index.test.d.ts +0 -1
- package/lib/components/ol-map/index.vue.d.ts +0 -59
- package/lib/components/ol-map/index.vue_vue_type_script_setup_true_lang.js +0 -1
- package/lib/components/ol-map/index2.js +0 -1
- package/lib/components/ol-map/props.d.ts +0 -38
- package/lib/components/ol-map/props.js +0 -1
- package/lib/composables/common/index.d.ts +0 -1
- package/lib/composables/common/index.js +0 -1
- package/lib/composables/index.d.ts +0 -6
- package/lib/composables/index.js +0 -1
- package/lib/composables/useContextmenu/index.d.ts +0 -71
- package/lib/composables/useContextmenu/index.js +0 -1
- package/lib/composables/useDrawLineString/index.d.ts +0 -109
- package/lib/composables/useDrawLineString/index.js +0 -1
- package/lib/composables/useDrawPolygon/index.d.ts +0 -109
- package/lib/composables/useDrawPolygon/index.js +0 -1
- package/lib/composables/useGraticule/index.d.ts +0 -20
- package/lib/composables/useGraticule/index.js +0 -1
- package/lib/composables/usePointermove/index.d.ts +0 -70
- package/lib/composables/usePointermove/index.js +0 -1
- package/lib/composables/useSwitchBaseLayer/index.d.ts +0 -11
- package/lib/composables/useSwitchBaseLayer/index.js +0 -1
- package/lib/constants/distance.d.ts +0 -1
- package/lib/constants/distance.js +0 -1
- package/lib/constants/index.d.ts +0 -2
- package/lib/constants/projection.d.ts +0 -9
- package/lib/constants/projection.js +0 -1
- package/lib/index.d.ts +0 -4
- package/lib/index.js +0 -1
- package/lib/types/index.d.ts +0 -4
- package/lib/utils/distance/index.d.ts +0 -8
- package/lib/utils/distance/index.js +0 -1
- package/lib/utils/feature/index.d.ts +0 -26
- package/lib/utils/feature/index.js +0 -1
- package/lib/utils/index.d.ts +0 -5
- package/lib/utils/index.js +0 -1
- package/lib/utils/layer/index.d.ts +0 -60
- package/lib/utils/layer/index.js +0 -1
- package/lib/utils/projection/index.d.ts +0 -18
- package/lib/utils/projection/index.js +0 -1
- package/lib/utils/style/index.d.ts +0 -27
- package/lib/utils/style/index.js +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@summeruse/ol",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "finalsummer",
|
|
7
7
|
"license": "ISC",
|
|
@@ -13,37 +13,32 @@
|
|
|
13
13
|
"openlayers",
|
|
14
14
|
"vue3"
|
|
15
15
|
],
|
|
16
|
-
"main": "
|
|
17
|
-
"module": "
|
|
18
|
-
"unpkg": "dist/index.js",
|
|
19
|
-
"jsdelivr": "dist/index.js",
|
|
20
|
-
"types": "
|
|
16
|
+
"main": "dist/index.js",
|
|
17
|
+
"module": "dist/index.js",
|
|
18
|
+
"unpkg": "dist/index.iife.min.js",
|
|
19
|
+
"jsdelivr": "dist/index.iife.min.js",
|
|
20
|
+
"types": "dist/index.d.ts",
|
|
21
21
|
"files": [
|
|
22
22
|
"CHANGELOG.md",
|
|
23
23
|
"README.md",
|
|
24
|
-
"dist"
|
|
25
|
-
"es",
|
|
26
|
-
"lib"
|
|
24
|
+
"dist"
|
|
27
25
|
],
|
|
28
26
|
"peerDependencies": {
|
|
29
|
-
"ol": "
|
|
27
|
+
"ol": "10.7.0",
|
|
30
28
|
"vue": "^3.5.13"
|
|
31
29
|
},
|
|
32
30
|
"devDependencies": {
|
|
33
|
-
"@types/node": "^22.13.14",
|
|
34
|
-
"@vitejs/plugin-vue": "6.0.1",
|
|
35
31
|
"@vue/tsconfig": "^0.7.0",
|
|
36
|
-
"
|
|
32
|
+
"pmtiles": "^4.3.2",
|
|
33
|
+
"proj4": "^2.20.2",
|
|
34
|
+
"tsdown": "0.18.3",
|
|
37
35
|
"typescript": "~5.7.2",
|
|
38
|
-
"
|
|
39
|
-
"vite-plugin-css-injected-by-js": "^3.5.2",
|
|
40
|
-
"vite-plugin-dts": "^4.5.3",
|
|
41
|
-
"vue-tsc": "^2.2.4"
|
|
36
|
+
"unplugin-vue": "7.1.0"
|
|
42
37
|
},
|
|
43
38
|
"publishConfig": {
|
|
44
39
|
"access": "public"
|
|
45
40
|
},
|
|
46
41
|
"scripts": {
|
|
47
|
-
"build": "
|
|
42
|
+
"build": "tsdown"
|
|
48
43
|
}
|
|
49
44
|
}
|
package/es/components/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ol-map';
|
package/es/components/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { MapEvent, Map as OLMap } from 'ol';
|
|
2
|
-
import { ObjectEvent } from 'ol/Object';
|
|
3
|
-
import { OlMapProps } from './props';
|
|
4
|
-
declare function __VLS_template(): {
|
|
5
|
-
attrs: Partial<{}>;
|
|
6
|
-
slots: {
|
|
7
|
-
default?(_: {
|
|
8
|
-
olMap: OLMap;
|
|
9
|
-
mapRef: HTMLDivElement | undefined;
|
|
10
|
-
}): any;
|
|
11
|
-
};
|
|
12
|
-
refs: {
|
|
13
|
-
mapRef: HTMLDivElement;
|
|
14
|
-
};
|
|
15
|
-
rootEl: HTMLDivElement;
|
|
16
|
-
};
|
|
17
|
-
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
18
|
-
declare const __VLS_component: import('vue').DefineComponent<OlMapProps, {
|
|
19
|
-
olMap: OLMap;
|
|
20
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
21
|
-
"update:zoom": (args_0: number) => any;
|
|
22
|
-
"update:center": (args_0: import('ol/coordinate').Coordinate) => any;
|
|
23
|
-
changeResolution: (args_0: ObjectEvent) => any;
|
|
24
|
-
changeCenter: (args_0: ObjectEvent) => any;
|
|
25
|
-
moveend: (args_0: MapEvent) => any;
|
|
26
|
-
movestart: (args_0: MapEvent) => any;
|
|
27
|
-
}, string, import('vue').PublicProps, Readonly<OlMapProps> & Readonly<{
|
|
28
|
-
"onUpdate:zoom"?: ((args_0: number) => any) | undefined;
|
|
29
|
-
"onUpdate:center"?: ((args_0: import('ol/coordinate').Coordinate) => any) | undefined;
|
|
30
|
-
onChangeResolution?: ((args_0: ObjectEvent) => any) | undefined;
|
|
31
|
-
onChangeCenter?: ((args_0: ObjectEvent) => any) | undefined;
|
|
32
|
-
onMoveend?: ((args_0: MapEvent) => any) | undefined;
|
|
33
|
-
onMovestart?: ((args_0: MapEvent) => any) | undefined;
|
|
34
|
-
}>, {
|
|
35
|
-
olMap: OLMap;
|
|
36
|
-
center: import('ol/coordinate').Coordinate;
|
|
37
|
-
zoom: number;
|
|
38
|
-
minZoom: number;
|
|
39
|
-
maxZoom: number;
|
|
40
|
-
constrainResolution: boolean;
|
|
41
|
-
showZoom: boolean;
|
|
42
|
-
showAttribution: boolean;
|
|
43
|
-
showRotate: boolean;
|
|
44
|
-
showFullScreen: boolean;
|
|
45
|
-
showOverview: boolean;
|
|
46
|
-
showScale: boolean;
|
|
47
|
-
dragPan: boolean;
|
|
48
|
-
mouseWheelZoom: boolean;
|
|
49
|
-
doubleClickZoom: boolean;
|
|
50
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
51
|
-
mapRef: HTMLDivElement;
|
|
52
|
-
}, HTMLDivElement>;
|
|
53
|
-
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
54
|
-
export default _default;
|
|
55
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
56
|
-
new (): {
|
|
57
|
-
$slots: S;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { olMapInjectionKey } from "./props.mjs";
|
|
2
|
-
import { createElementBlock, defineComponent, onMounted, onUnmounted, openBlock, provide, ref, renderSlot, unref, watch } from "vue";
|
|
3
|
-
import { Map, View } from "ol";
|
|
4
|
-
import { Attribution, FullScreen, OverviewMap, Rotate, ScaleLine, Zoom } from "ol/control";
|
|
5
|
-
import { DoubleClickZoom, DragPan, DragRotate, KeyboardPan, KeyboardZoom, MouseWheelZoom, PinchRotate, PinchZoom } from "ol/interaction";
|
|
6
|
-
var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
7
|
-
name: "OlMap",
|
|
8
|
-
__name: "index",
|
|
9
|
-
props: {
|
|
10
|
-
olMap: { default: () => new Map() },
|
|
11
|
-
center: { default: () => [0, 0] },
|
|
12
|
-
zoom: { default: 2 },
|
|
13
|
-
minZoom: { default: 2 },
|
|
14
|
-
maxZoom: { default: 18 },
|
|
15
|
-
constrainResolution: {
|
|
16
|
-
type: Boolean,
|
|
17
|
-
default: !0
|
|
18
|
-
},
|
|
19
|
-
projection: {},
|
|
20
|
-
extent: {},
|
|
21
|
-
showZoom: {
|
|
22
|
-
type: Boolean,
|
|
23
|
-
default: !1
|
|
24
|
-
},
|
|
25
|
-
showAttribution: {
|
|
26
|
-
type: Boolean,
|
|
27
|
-
default: !1
|
|
28
|
-
},
|
|
29
|
-
showRotate: {
|
|
30
|
-
type: Boolean,
|
|
31
|
-
default: !1
|
|
32
|
-
},
|
|
33
|
-
showFullScreen: {
|
|
34
|
-
type: Boolean,
|
|
35
|
-
default: !1
|
|
36
|
-
},
|
|
37
|
-
showOverview: {
|
|
38
|
-
type: Boolean,
|
|
39
|
-
default: !1
|
|
40
|
-
},
|
|
41
|
-
showScale: {
|
|
42
|
-
type: Boolean,
|
|
43
|
-
default: !1
|
|
44
|
-
},
|
|
45
|
-
dragPan: {
|
|
46
|
-
type: Boolean,
|
|
47
|
-
default: !0
|
|
48
|
-
},
|
|
49
|
-
mouseWheelZoom: {
|
|
50
|
-
type: Boolean,
|
|
51
|
-
default: !0
|
|
52
|
-
},
|
|
53
|
-
doubleClickZoom: {
|
|
54
|
-
type: Boolean,
|
|
55
|
-
default: !1
|
|
56
|
-
},
|
|
57
|
-
pinchRotate: { type: Boolean },
|
|
58
|
-
pinchZoom: { type: Boolean },
|
|
59
|
-
altShiftDragRotate: { type: Boolean }
|
|
60
|
-
},
|
|
61
|
-
emits: [
|
|
62
|
-
"update:zoom",
|
|
63
|
-
"update:center",
|
|
64
|
-
"changeResolution",
|
|
65
|
-
"changeCenter",
|
|
66
|
-
"moveend",
|
|
67
|
-
"movestart"
|
|
68
|
-
],
|
|
69
|
-
setup(T, { expose: E, emit: D }) {
|
|
70
|
-
let O = T, k = D, A = ref(), j = O.olMap, M = new View({
|
|
71
|
-
projection: O.projection,
|
|
72
|
-
extent: O.extent
|
|
73
|
-
});
|
|
74
|
-
j.setView(M), M.setZoom(O.zoom), M.setCenter(O.center), watch(() => O.constrainResolution, (e) => {
|
|
75
|
-
M.setConstrainResolution(e);
|
|
76
|
-
}, { immediate: !0 }), watch(() => O.minZoom, (e) => {
|
|
77
|
-
e && M.setMinZoom(e);
|
|
78
|
-
}, { immediate: !0 }), watch(() => O.maxZoom, (e) => {
|
|
79
|
-
e && M.setMaxZoom(e);
|
|
80
|
-
}, { immediate: !0 }), watch(A, (e) => {
|
|
81
|
-
e && j.setTarget(e);
|
|
82
|
-
}), E({ olMap: j }), provide(olMapInjectionKey, j);
|
|
83
|
-
let N = j.getControls().getArray(), P = N.find((e) => e instanceof Zoom) || new Zoom(), F = N.find((e) => e instanceof Attribution) || new Attribution(), I = N.find((e) => e instanceof Rotate) || new Rotate(), L = N.find((e) => e instanceof FullScreen) || new FullScreen(), R = N.find((e) => e instanceof OverviewMap) || new OverviewMap(), z = N.find((e) => e instanceof ScaleLine) || new ScaleLine();
|
|
84
|
-
watch(() => O.showZoom, (e) => {
|
|
85
|
-
P.setMap(e ? j : null);
|
|
86
|
-
}, { immediate: !0 }), watch(() => O.showAttribution, (e) => {
|
|
87
|
-
F.setMap(e ? j : null);
|
|
88
|
-
}, { immediate: !0 }), watch(() => O.showRotate, (e) => {
|
|
89
|
-
I.setMap(e ? j : null);
|
|
90
|
-
}, { immediate: !0 }), watch(() => O.showFullScreen, (e) => {
|
|
91
|
-
L.setMap(e ? j : null);
|
|
92
|
-
}, { immediate: !0 }), watch(() => O.showOverview, (e) => {
|
|
93
|
-
R.setMap(e ? j : null);
|
|
94
|
-
}, { immediate: !0 }), watch(() => O.showScale, (e) => {
|
|
95
|
-
z.setMap(e ? j : null);
|
|
96
|
-
}, { immediate: !0 });
|
|
97
|
-
let B = j.getInteractions().getArray(), V = B.find((e) => e instanceof DragPan) || new DragPan(), H = B.find((e) => e instanceof MouseWheelZoom) || new MouseWheelZoom(), U = B.find((e) => e instanceof DoubleClickZoom) || new DoubleClickZoom(), W = B.find((e) => e instanceof PinchRotate) || new PinchRotate(), G = B.find((e) => e instanceof PinchZoom) || new PinchZoom(), K = B.find((e) => e instanceof DragRotate) || new DragRotate(), q = B.find((e) => e instanceof KeyboardPan) || new KeyboardPan(), J = B.find((e) => e instanceof KeyboardZoom) || new KeyboardZoom();
|
|
98
|
-
j.removeInteraction(V), j.addInteraction(V), j.removeInteraction(H), j.addInteraction(H), j.removeInteraction(U), j.addInteraction(U), j.removeInteraction(W), j.addInteraction(W), j.removeInteraction(G), j.addInteraction(G), j.removeInteraction(K), j.addInteraction(K), j.removeInteraction(q), j.removeInteraction(J), watch(() => O.dragPan, (e) => {
|
|
99
|
-
V.setActive(e);
|
|
100
|
-
}, { immediate: !0 }), watch(() => O.mouseWheelZoom, (e) => {
|
|
101
|
-
H.setActive(e);
|
|
102
|
-
}, { immediate: !0 }), watch(() => O.doubleClickZoom, (e) => {
|
|
103
|
-
U.setActive(e);
|
|
104
|
-
}, { immediate: !0 }), watch(() => O.pinchRotate, (e) => {
|
|
105
|
-
W.setActive(e);
|
|
106
|
-
}, { immediate: !0 }), watch(() => O.pinchZoom, (e) => {
|
|
107
|
-
G.setActive(e);
|
|
108
|
-
}, { immediate: !0 }), watch(() => O.altShiftDragRotate, (e) => {
|
|
109
|
-
K.setActive(e);
|
|
110
|
-
}, { immediate: !0 });
|
|
111
|
-
function Y(e) {
|
|
112
|
-
k("update:zoom", Math.floor(M.getZoom() || 0)), k("changeResolution", e);
|
|
113
|
-
}
|
|
114
|
-
onMounted(() => {
|
|
115
|
-
M.on("change:resolution", Y);
|
|
116
|
-
}), onUnmounted(() => {
|
|
117
|
-
M.un("change:resolution", Y);
|
|
118
|
-
});
|
|
119
|
-
function X(e) {
|
|
120
|
-
k("update:center", M.getCenter() || [0, 0]), k("changeCenter", e);
|
|
121
|
-
}
|
|
122
|
-
onMounted(() => {
|
|
123
|
-
M.on("change:center", X);
|
|
124
|
-
}), onUnmounted(() => {
|
|
125
|
-
M.un("change:center", X);
|
|
126
|
-
});
|
|
127
|
-
function Z(e) {
|
|
128
|
-
k("movestart", e);
|
|
129
|
-
}
|
|
130
|
-
onMounted(() => {
|
|
131
|
-
j.on("movestart", Z);
|
|
132
|
-
}), onUnmounted(() => {
|
|
133
|
-
j.un("movestart", Z);
|
|
134
|
-
});
|
|
135
|
-
function Q(e) {
|
|
136
|
-
k("moveend", e);
|
|
137
|
-
}
|
|
138
|
-
return onMounted(() => {
|
|
139
|
-
j.on("moveend", Q);
|
|
140
|
-
}), onUnmounted(() => {
|
|
141
|
-
j.un("moveend", Q);
|
|
142
|
-
}), (e, T) => (openBlock(), createElementBlock("div", {
|
|
143
|
-
ref_key: "mapRef",
|
|
144
|
-
ref: A
|
|
145
|
-
}, [renderSlot(e.$slots, "default", {
|
|
146
|
-
olMap: unref(j),
|
|
147
|
-
mapRef: A.value
|
|
148
|
-
})], 512));
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
export { index_vue_vue_type_script_setup_true_lang_default as default };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { MapEvent, Map as OLMap } from 'ol';
|
|
2
|
-
import { Coordinate } from 'ol/coordinate';
|
|
3
|
-
import { Extent } from 'ol/extent';
|
|
4
|
-
import { ObjectEvent } from 'ol/Object';
|
|
5
|
-
import { InjectionKey } from 'vue';
|
|
6
|
-
import { ProjectionLike } from '../../constants/projection';
|
|
7
|
-
export interface OlMapProps {
|
|
8
|
-
olMap?: OLMap;
|
|
9
|
-
center?: Coordinate;
|
|
10
|
-
zoom?: number;
|
|
11
|
-
minZoom?: number;
|
|
12
|
-
maxZoom?: number;
|
|
13
|
-
constrainResolution?: boolean;
|
|
14
|
-
projection?: ProjectionLike;
|
|
15
|
-
extent?: Extent;
|
|
16
|
-
showZoom?: boolean;
|
|
17
|
-
showAttribution?: boolean;
|
|
18
|
-
showRotate?: boolean;
|
|
19
|
-
showFullScreen?: boolean;
|
|
20
|
-
showOverview?: boolean;
|
|
21
|
-
showScale?: boolean;
|
|
22
|
-
dragPan?: boolean;
|
|
23
|
-
mouseWheelZoom?: boolean;
|
|
24
|
-
doubleClickZoom?: boolean;
|
|
25
|
-
pinchRotate?: boolean;
|
|
26
|
-
pinchZoom?: boolean;
|
|
27
|
-
altShiftDragRotate?: boolean;
|
|
28
|
-
}
|
|
29
|
-
export declare const olMapInjectionKey: InjectionKey<OLMap>;
|
|
30
|
-
export declare function useOlMap(): OLMap | undefined;
|
|
31
|
-
export interface OlMapEmits {
|
|
32
|
-
'update:zoom': [number];
|
|
33
|
-
'update:center': [Coordinate];
|
|
34
|
-
'changeResolution': [ObjectEvent];
|
|
35
|
-
'changeCenter': [ObjectEvent];
|
|
36
|
-
'moveend': [MapEvent];
|
|
37
|
-
'movestart': [MapEvent];
|
|
38
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function createToolTipElement(text: string): HTMLDivElement;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
function createToolTipElement(e) {
|
|
2
|
-
let t = document.createElement("div");
|
|
3
|
-
return t.innerHTML = e, t.style.cursor = "pointer", t.style.userSelect = "none", t.style.backgroundColor = "red", t.style.color = "white", t.style.borderRadius = "5px", t.style.padding = "0 5px", t.style.fontSize = "12px", t.style.border = "2px solid white", t;
|
|
4
|
-
}
|
|
5
|
-
export { createToolTipElement };
|
package/es/composables/index.mjs
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { useContextmenu } from "./useContextmenu/index.mjs";
|
|
2
|
-
import { useDrawLineString } from "./useDrawLineString/index.mjs";
|
|
3
|
-
import { useDrawPolygon } from "./useDrawPolygon/index.mjs";
|
|
4
|
-
import { useGraticule } from "./useGraticule/index.mjs";
|
|
5
|
-
import { usePointermove } from "./usePointermove/index.mjs";
|
|
6
|
-
import { useSwitchBaseLayer } from "./useSwitchBaseLayer/index.mjs";
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { Coordinate } from 'ol/coordinate';
|
|
2
|
-
import { FeatureLike } from 'ol/Feature';
|
|
3
|
-
import { MaybeRefOrGetter, VNodeChild } from 'vue';
|
|
4
|
-
import { LayerLike, OLMap } from '../../types';
|
|
5
|
-
export interface ContextmenuPosition {
|
|
6
|
-
x: number;
|
|
7
|
-
y: number;
|
|
8
|
-
}
|
|
9
|
-
interface ContextmenuItemParams {
|
|
10
|
-
map: OLMap;
|
|
11
|
-
coordinate: Coordinate;
|
|
12
|
-
position: ContextmenuPosition;
|
|
13
|
-
feature?: FeatureLike;
|
|
14
|
-
layer?: LayerLike;
|
|
15
|
-
}
|
|
16
|
-
export interface ContextmenuItemBase {
|
|
17
|
-
label: ((params: ContextmenuItemParams) => VNodeChild) | string;
|
|
18
|
-
visible?: ((params: ContextmenuItemParams) => boolean) | boolean;
|
|
19
|
-
disabled?: ((params: ContextmenuItemParams) => boolean) | boolean;
|
|
20
|
-
action?: (params: ContextmenuItemParams) => void;
|
|
21
|
-
divided?: boolean;
|
|
22
|
-
icon?: ((params: ContextmenuItemParams) => VNodeChild) | string;
|
|
23
|
-
order?: number;
|
|
24
|
-
key?: string | number;
|
|
25
|
-
[key: string]: any;
|
|
26
|
-
}
|
|
27
|
-
export interface ContextmenuItem extends ContextmenuItemBase {
|
|
28
|
-
children?: Array<ContextmenuItem>;
|
|
29
|
-
}
|
|
30
|
-
export type ContextmenuList = ContextmenuItem[];
|
|
31
|
-
export interface ContextmenuOptionBase {
|
|
32
|
-
label: string | (() => VNodeChild);
|
|
33
|
-
visible?: boolean;
|
|
34
|
-
disabled?: boolean;
|
|
35
|
-
action: () => void;
|
|
36
|
-
divided?: boolean;
|
|
37
|
-
icon?: string | (() => VNodeChild);
|
|
38
|
-
order?: number;
|
|
39
|
-
key?: string | number;
|
|
40
|
-
[key: string]: any;
|
|
41
|
-
}
|
|
42
|
-
export interface ContextmenuOption extends ContextmenuOptionBase {
|
|
43
|
-
children?: Array<ContextmenuOption>;
|
|
44
|
-
}
|
|
45
|
-
export type ContextmenuOptions = ContextmenuOption[];
|
|
46
|
-
export declare function useContextmenu(mapRef: MaybeRefOrGetter<OLMap | undefined>, items: MaybeRefOrGetter<ContextmenuList>): {
|
|
47
|
-
visible: import('vue').ComputedRef<boolean>;
|
|
48
|
-
position: import('vue').ComputedRef<{
|
|
49
|
-
x: number;
|
|
50
|
-
y: number;
|
|
51
|
-
}>;
|
|
52
|
-
feature: import('vue').ComputedRef<FeatureLike | undefined>;
|
|
53
|
-
options: import('vue').ComputedRef<{
|
|
54
|
-
[x: string]: any;
|
|
55
|
-
children?: /*elided*/ any[] | undefined;
|
|
56
|
-
label: string | (() => VNodeChild);
|
|
57
|
-
visible?: boolean | undefined;
|
|
58
|
-
disabled?: boolean | undefined;
|
|
59
|
-
action: () => void;
|
|
60
|
-
divided?: boolean | undefined;
|
|
61
|
-
icon?: string | (() => VNodeChild) | undefined;
|
|
62
|
-
order?: number | undefined;
|
|
63
|
-
key?: string | number | undefined;
|
|
64
|
-
}[]>;
|
|
65
|
-
coordinate: import('vue').ComputedRef<Coordinate | undefined>;
|
|
66
|
-
hide: () => void;
|
|
67
|
-
};
|
|
68
|
-
export type UseContextmenuReturn = ReturnType<typeof useContextmenu>;
|
|
69
|
-
export type UseContextmenuParams = Parameters<typeof useContextmenu>;
|
|
70
|
-
export type UseContextmenuFn = (...args: UseContextmenuParams) => UseContextmenuReturn;
|
|
71
|
-
export {};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { computed, onBeforeUnmount, ref, toValue, watch } from "vue";
|
|
2
|
-
function useContextmenu(a, o) {
|
|
3
|
-
let s = ref(!1), c = ref({
|
|
4
|
-
x: 0,
|
|
5
|
-
y: 0
|
|
6
|
-
}), l = ref(), u = ref([]), d = ref(), f;
|
|
7
|
-
function p(e, t) {
|
|
8
|
-
let n = [];
|
|
9
|
-
return e.filter((e) => {
|
|
10
|
-
let n = e.visible;
|
|
11
|
-
return typeof n == "function" ? n(t) : n ?? !0;
|
|
12
|
-
}).filter((e) => !e.children || e.children.length > 0).sort((e, t) => (e.order ?? 0) - (t.order ?? 0)).forEach((e) => {
|
|
13
|
-
let r = e.icon, i = e.label;
|
|
14
|
-
n.push({
|
|
15
|
-
...e,
|
|
16
|
-
children: e.children ? p(e.children, t) : void 0,
|
|
17
|
-
visible: !0,
|
|
18
|
-
action: () => {
|
|
19
|
-
e.action?.(t), h();
|
|
20
|
-
},
|
|
21
|
-
icon: typeof r == "function" ? () => r(t) : r,
|
|
22
|
-
label: typeof i == "function" ? () => i(t) : i,
|
|
23
|
-
disabled: typeof e.disabled == "function" ? e.disabled(t) : e.disabled ?? !1
|
|
24
|
-
});
|
|
25
|
-
}), n;
|
|
26
|
-
}
|
|
27
|
-
function m(e) {
|
|
28
|
-
if (e.preventDefault(), !f) return;
|
|
29
|
-
let t = f.getEventCoordinate(e);
|
|
30
|
-
d.value = t;
|
|
31
|
-
let n = f.getEventPixel(e), i, a;
|
|
32
|
-
f.forEachFeatureAtPixel(n, (e, t) => (i = e, a = t, !0)), l.value = i;
|
|
33
|
-
let [m, h] = [e.clientX, e.clientY];
|
|
34
|
-
c.value = {
|
|
35
|
-
x: m,
|
|
36
|
-
y: h
|
|
37
|
-
}, u.value = p(toValue(o), {
|
|
38
|
-
map: f,
|
|
39
|
-
position: { ...c.value },
|
|
40
|
-
coordinate: t,
|
|
41
|
-
feature: i,
|
|
42
|
-
layer: a
|
|
43
|
-
}), s.value = !0;
|
|
44
|
-
}
|
|
45
|
-
function h() {
|
|
46
|
-
s.value = !1;
|
|
47
|
-
}
|
|
48
|
-
function g(e) {
|
|
49
|
-
if (!e) return;
|
|
50
|
-
let t = e.getViewport();
|
|
51
|
-
t.addEventListener("contextmenu", m), t.addEventListener("click", h);
|
|
52
|
-
}
|
|
53
|
-
function _(e) {
|
|
54
|
-
if (!e) return;
|
|
55
|
-
let t = e.getViewport();
|
|
56
|
-
t.removeEventListener("contextmenu", m), t.removeEventListener("click", h);
|
|
57
|
-
}
|
|
58
|
-
return watch(() => toValue(a), (e, t) => {
|
|
59
|
-
t !== e && (_(t), g(e), f = e);
|
|
60
|
-
}, { immediate: !0 }), onBeforeUnmount(() => {
|
|
61
|
-
_(f);
|
|
62
|
-
}), {
|
|
63
|
-
visible: computed(() => s.value),
|
|
64
|
-
position: computed(() => c.value),
|
|
65
|
-
feature: computed(() => l.value),
|
|
66
|
-
options: computed(() => u.value),
|
|
67
|
-
coordinate: computed(() => d.value),
|
|
68
|
-
hide: h
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
export { useContextmenu };
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { Coordinate } from 'ol/coordinate';
|
|
2
|
-
import { Style } from 'ol/style';
|
|
3
|
-
import { VNode } from 'vue';
|
|
4
|
-
import { OLMap } from '../../types';
|
|
5
|
-
import { StyleOptions } from '../../utils';
|
|
6
|
-
import { Feature } from 'ol';
|
|
7
|
-
import { LineString } from 'ol/geom';
|
|
8
|
-
export interface DrawLineStringOptions {
|
|
9
|
-
defaultCoordinates?: Coordinate[][];
|
|
10
|
-
deletePointLabel?: VNode;
|
|
11
|
-
deleteFeatureLabel?: VNode;
|
|
12
|
-
style?: Style;
|
|
13
|
-
styleOptions?: StyleOptions;
|
|
14
|
-
drawStyle?: Style;
|
|
15
|
-
drawStyleOptions?: StyleOptions;
|
|
16
|
-
modifyStyle?: Style;
|
|
17
|
-
modifyStyleOptions?: StyleOptions;
|
|
18
|
-
zIndex?: number;
|
|
19
|
-
size?: number;
|
|
20
|
-
}
|
|
21
|
-
export declare function useDrawLineString(olMap: OLMap, options: DrawLineStringOptions): {
|
|
22
|
-
inDraw: import('vue').Ref<boolean, boolean>;
|
|
23
|
-
start: () => void;
|
|
24
|
-
stop: () => void;
|
|
25
|
-
clear: () => void;
|
|
26
|
-
setFeatures: (coordinates: Coordinate[][]) => void;
|
|
27
|
-
reset: () => void;
|
|
28
|
-
features: import('vue').Ref<{
|
|
29
|
-
on: import('ol/Feature').FeatureOnSignature<import('ol/events').EventsKey>;
|
|
30
|
-
once: import('ol/Feature').FeatureOnSignature<import('ol/events').EventsKey>;
|
|
31
|
-
un: import('ol/Feature').FeatureOnSignature<void>;
|
|
32
|
-
clone: () => Feature<LineString>;
|
|
33
|
-
getGeometry: () => LineString | undefined;
|
|
34
|
-
getId: () => number | string | undefined;
|
|
35
|
-
getGeometryName: () => string;
|
|
36
|
-
getStyle: () => import('ol/style/Style').StyleLike | undefined;
|
|
37
|
-
getStyleFunction: () => import('ol/style/Style').StyleFunction | undefined;
|
|
38
|
-
setGeometry: (geometry: LineString | undefined) => void;
|
|
39
|
-
setStyle: (style?: import('ol/style/Style').StyleLike) => void;
|
|
40
|
-
setId: (id: number | string | undefined) => void;
|
|
41
|
-
setGeometryName: (name: string) => void;
|
|
42
|
-
get: (key: string) => any;
|
|
43
|
-
getKeys: () => Array<string>;
|
|
44
|
-
getProperties: () => {
|
|
45
|
-
[x: string]: any;
|
|
46
|
-
};
|
|
47
|
-
getPropertiesInternal: () => {
|
|
48
|
-
[x: string]: any;
|
|
49
|
-
} | null;
|
|
50
|
-
hasProperties: () => boolean;
|
|
51
|
-
notify: (key: string, oldValue: any) => void;
|
|
52
|
-
addChangeListener: (key: string, listener: import('ol/events').Listener) => void;
|
|
53
|
-
removeChangeListener: (key: string, listener: import('ol/events').Listener) => void;
|
|
54
|
-
set: (key: string, value: any, silent?: boolean) => void;
|
|
55
|
-
setProperties: (values: {
|
|
56
|
-
[x: string]: any;
|
|
57
|
-
}, silent?: boolean) => void;
|
|
58
|
-
unset: (key: string, silent?: boolean) => void;
|
|
59
|
-
changed: () => void;
|
|
60
|
-
getRevision: () => number;
|
|
61
|
-
addEventListener: (type: string, listener: import('ol/events').Listener) => void;
|
|
62
|
-
dispatchEvent: (event: import('ol/events/Event').default | string) => boolean | undefined;
|
|
63
|
-
getListeners: (type: string) => Array<import('ol/events').Listener> | undefined;
|
|
64
|
-
hasListener: (type?: string) => boolean;
|
|
65
|
-
removeEventListener: (type: string, listener: import('ol/events').Listener) => void;
|
|
66
|
-
dispose: () => void;
|
|
67
|
-
}[], Feature<LineString>[] | {
|
|
68
|
-
on: import('ol/Feature').FeatureOnSignature<import('ol/events').EventsKey>;
|
|
69
|
-
once: import('ol/Feature').FeatureOnSignature<import('ol/events').EventsKey>;
|
|
70
|
-
un: import('ol/Feature').FeatureOnSignature<void>;
|
|
71
|
-
clone: () => Feature<LineString>;
|
|
72
|
-
getGeometry: () => LineString | undefined;
|
|
73
|
-
getId: () => number | string | undefined;
|
|
74
|
-
getGeometryName: () => string;
|
|
75
|
-
getStyle: () => import('ol/style/Style').StyleLike | undefined;
|
|
76
|
-
getStyleFunction: () => import('ol/style/Style').StyleFunction | undefined;
|
|
77
|
-
setGeometry: (geometry: LineString | undefined) => void;
|
|
78
|
-
setStyle: (style?: import('ol/style/Style').StyleLike) => void;
|
|
79
|
-
setId: (id: number | string | undefined) => void;
|
|
80
|
-
setGeometryName: (name: string) => void;
|
|
81
|
-
get: (key: string) => any;
|
|
82
|
-
getKeys: () => Array<string>;
|
|
83
|
-
getProperties: () => {
|
|
84
|
-
[x: string]: any;
|
|
85
|
-
};
|
|
86
|
-
getPropertiesInternal: () => {
|
|
87
|
-
[x: string]: any;
|
|
88
|
-
} | null;
|
|
89
|
-
hasProperties: () => boolean;
|
|
90
|
-
notify: (key: string, oldValue: any) => void;
|
|
91
|
-
addChangeListener: (key: string, listener: import('ol/events').Listener) => void;
|
|
92
|
-
removeChangeListener: (key: string, listener: import('ol/events').Listener) => void;
|
|
93
|
-
set: (key: string, value: any, silent?: boolean) => void;
|
|
94
|
-
setProperties: (values: {
|
|
95
|
-
[x: string]: any;
|
|
96
|
-
}, silent?: boolean) => void;
|
|
97
|
-
unset: (key: string, silent?: boolean) => void;
|
|
98
|
-
changed: () => void;
|
|
99
|
-
getRevision: () => number;
|
|
100
|
-
addEventListener: (type: string, listener: import('ol/events').Listener) => void;
|
|
101
|
-
dispatchEvent: (event: import('ol/events/Event').default | string) => boolean | undefined;
|
|
102
|
-
getListeners: (type: string) => Array<import('ol/events').Listener> | undefined;
|
|
103
|
-
hasListener: (type?: string) => boolean;
|
|
104
|
-
removeEventListener: (type: string, listener: import('ol/events').Listener) => void;
|
|
105
|
-
dispose: () => void;
|
|
106
|
-
}[]>;
|
|
107
|
-
coordinates: import('vue').ComputedRef<Coordinate[][]>;
|
|
108
|
-
destroy: () => void;
|
|
109
|
-
};
|