@movk/maplibre 1.0.0 → 1.2.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/README.en.md +2 -2
- package/README.md +2 -2
- package/dist/module.d.mts +12 -3
- package/dist/module.d.ts +12 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +26 -11
- package/dist/runtime/components/CustomLayer.d.vue.ts +1 -1
- package/dist/runtime/components/CustomLayer.vue +18 -4
- package/dist/runtime/components/CustomLayer.vue.d.ts +1 -1
- package/dist/runtime/components/Layer.d.vue.ts +4 -4
- package/dist/runtime/components/Layer.vue +43 -18
- package/dist/runtime/components/Layer.vue.d.ts +4 -4
- package/dist/runtime/components/LayerGroup.d.vue.ts +23 -10
- package/dist/runtime/components/LayerGroup.vue +44 -4
- package/dist/runtime/components/LayerGroup.vue.d.ts +23 -10
- package/dist/runtime/components/LottieMarker.d.vue.ts +3 -3
- package/dist/runtime/components/LottieMarker.vue +6 -2
- package/dist/runtime/components/LottieMarker.vue.d.ts +3 -3
- package/dist/runtime/components/Map.d.vue.ts +2 -1
- package/dist/runtime/components/Map.vue +2 -6
- package/dist/runtime/components/Map.vue.d.ts +2 -1
- package/dist/runtime/components/Marker.d.vue.ts +2 -1
- package/dist/runtime/components/Marker.vue +33 -9
- package/dist/runtime/components/Marker.vue.d.ts +2 -1
- package/dist/runtime/components/Popup.d.vue.ts +1 -1
- package/dist/runtime/components/Popup.vue +23 -4
- package/dist/runtime/components/Popup.vue.d.ts +1 -1
- package/dist/runtime/components/Source.d.vue.ts +2 -2
- package/dist/runtime/components/Source.vue +3 -15
- package/dist/runtime/components/Source.vue.d.ts +2 -2
- package/dist/runtime/components/Tooltip.d.vue.ts +2 -2
- package/dist/runtime/components/Tooltip.vue +47 -19
- package/dist/runtime/components/Tooltip.vue.d.ts +2 -2
- package/dist/runtime/components/buffers/BufferCircle.d.vue.ts +1 -1
- package/dist/runtime/components/buffers/BufferCircle.vue.d.ts +1 -1
- package/dist/runtime/components/buffers/BufferEllipse.d.vue.ts +1 -1
- package/dist/runtime/components/buffers/BufferEllipse.vue.d.ts +1 -1
- package/dist/runtime/components/buffers/BufferLine.d.vue.ts +1 -1
- package/dist/runtime/components/buffers/BufferLine.vue.d.ts +1 -1
- package/dist/runtime/components/buffers/BufferPolygon.d.vue.ts +1 -1
- package/dist/runtime/components/buffers/BufferPolygon.vue.d.ts +1 -1
- package/dist/runtime/components/buffers/BufferSector.d.vue.ts +1 -1
- package/dist/runtime/components/buffers/BufferSector.vue.d.ts +1 -1
- package/dist/runtime/components/controls/BasemapControl.d.vue.ts +35 -0
- package/dist/runtime/components/controls/BasemapControl.vue +60 -0
- package/dist/runtime/components/controls/BasemapControl.vue.d.ts +35 -0
- package/dist/runtime/components/controls/Control.d.vue.ts +51 -0
- package/dist/runtime/components/controls/Control.vue +95 -0
- package/dist/runtime/components/controls/Control.vue.d.ts +51 -0
- package/dist/runtime/components/controls/GlobeControl.d.vue.ts +18 -0
- package/dist/runtime/components/controls/GlobeControl.vue +15 -0
- package/dist/runtime/components/controls/GlobeControl.vue.d.ts +18 -0
- package/dist/runtime/components/controls/LayerControl.d.vue.ts +44 -0
- package/dist/runtime/components/controls/LayerControl.vue +63 -0
- package/dist/runtime/components/controls/LayerControl.vue.d.ts +44 -0
- package/dist/runtime/components/controls/Legend.d.vue.ts +47 -0
- package/dist/runtime/components/controls/Legend.vue +69 -0
- package/dist/runtime/components/controls/Legend.vue.d.ts +47 -0
- package/dist/runtime/components/controls/Minimap.d.vue.ts +45 -0
- package/dist/runtime/components/controls/Minimap.vue +31 -0
- package/dist/runtime/components/controls/Minimap.vue.d.ts +45 -0
- package/dist/runtime/components/effects/AnimatedImage.d.vue.ts +1 -1
- package/dist/runtime/components/effects/AnimatedImage.vue +9 -6
- package/dist/runtime/components/effects/AnimatedImage.vue.d.ts +1 -1
- package/dist/runtime/components/effects/DiffusionCircle.d.vue.ts +1 -1
- package/dist/runtime/components/effects/DiffusionCircle.vue.d.ts +1 -1
- package/dist/runtime/components/effects/FlowBuilding.d.vue.ts +1 -1
- package/dist/runtime/components/effects/FlowBuilding.vue.d.ts +1 -1
- package/dist/runtime/components/effects/GlowCircle.d.vue.ts +1 -1
- package/dist/runtime/components/effects/GlowCircle.vue.d.ts +1 -1
- package/dist/runtime/components/effects/GradientBuilding.d.vue.ts +1 -1
- package/dist/runtime/components/effects/GradientBuilding.vue.d.ts +1 -1
- package/dist/runtime/components/effects/Migration.d.vue.ts +1 -1
- package/dist/runtime/components/effects/Migration.vue.d.ts +1 -1
- package/dist/runtime/components/effects/Radar.d.vue.ts +1 -1
- package/dist/runtime/components/effects/Radar.vue.d.ts +1 -1
- package/dist/runtime/components/effects/SpriteImage.d.vue.ts +1 -1
- package/dist/runtime/components/effects/SpriteImage.vue +40 -24
- package/dist/runtime/components/effects/SpriteImage.vue.d.ts +1 -1
- package/dist/runtime/components/effects/TextureBuilding.d.vue.ts +1 -1
- package/dist/runtime/components/effects/TextureBuilding.vue +1 -1
- package/dist/runtime/components/effects/TextureBuilding.vue.d.ts +1 -1
- package/dist/runtime/components/effects/Trail.d.vue.ts +1 -1
- package/dist/runtime/components/effects/Trail.vue.d.ts +1 -1
- package/dist/runtime/components/effects/WaveCircle.d.vue.ts +1 -1
- package/dist/runtime/components/effects/WaveCircle.vue.d.ts +1 -1
- package/dist/runtime/components/effects/WindowBuilding.d.vue.ts +1 -1
- package/dist/runtime/components/effects/WindowBuilding.vue.d.ts +1 -1
- package/dist/runtime/components/environment/Projection.d.vue.ts +28 -0
- package/dist/runtime/components/environment/Projection.vue +27 -0
- package/dist/runtime/components/environment/Projection.vue.d.ts +28 -0
- package/dist/runtime/components/environment/Temperature.d.vue.ts +1 -1
- package/dist/runtime/components/environment/Temperature.vue.d.ts +1 -1
- package/dist/runtime/components/environment/Terrain.d.vue.ts +1 -1
- package/dist/runtime/components/environment/Terrain.vue +5 -0
- package/dist/runtime/components/environment/Terrain.vue.d.ts +1 -1
- package/dist/runtime/components/extensions/DrawControl.vue +23 -19
- package/dist/runtime/components/extensions/Swipe.d.vue.ts +48 -0
- package/dist/runtime/components/extensions/Swipe.vue +141 -0
- package/dist/runtime/components/extensions/Swipe.vue.d.ts +48 -0
- package/dist/runtime/components/layers/BuildingLayer.d.vue.ts +1 -1
- package/dist/runtime/components/layers/BuildingLayer.vue.d.ts +1 -1
- package/dist/runtime/components/layers/ClusterLayer.d.vue.ts +1 -1
- package/dist/runtime/components/layers/ClusterLayer.vue.d.ts +1 -1
- package/dist/runtime/components/layers/ContourLayer.d.vue.ts +59 -0
- package/dist/runtime/components/layers/ContourLayer.vue +84 -0
- package/dist/runtime/components/layers/ContourLayer.vue.d.ts +59 -0
- package/dist/runtime/components/layers/GraticuleLayer.d.vue.ts +31 -0
- package/dist/runtime/components/layers/GraticuleLayer.vue +88 -0
- package/dist/runtime/components/layers/GraticuleLayer.vue.d.ts +31 -0
- package/dist/runtime/components/layers/ImageLayer.d.vue.ts +1 -1
- package/dist/runtime/components/layers/ImageLayer.vue.d.ts +1 -1
- package/dist/runtime/components/layers/MaskLayer.d.vue.ts +44 -0
- package/dist/runtime/components/layers/MaskLayer.vue +32 -0
- package/dist/runtime/components/layers/MaskLayer.vue.d.ts +44 -0
- package/dist/runtime/components/layers/RasterLayer.d.vue.ts +5 -3
- package/dist/runtime/components/layers/RasterLayer.vue +9 -2
- package/dist/runtime/components/layers/RasterLayer.vue.d.ts +5 -3
- package/dist/runtime/components/layers/VideoLayer.d.vue.ts +1 -1
- package/dist/runtime/components/layers/VideoLayer.vue.d.ts +1 -1
- package/dist/runtime/composables/useFeatureState.js +27 -5
- package/dist/runtime/composables/useFrameIcon.d.ts +4 -3
- package/dist/runtime/composables/useFrameIcon.js +18 -8
- package/dist/runtime/composables/useLayerTree.d.ts +11 -0
- package/dist/runtime/composables/useLayerTree.js +12 -0
- package/dist/runtime/composables/useMapAnimation.d.ts +4 -2
- package/dist/runtime/composables/useMapAnimation.js +5 -4
- package/dist/runtime/composables/useMapExport.js +2 -5
- package/dist/runtime/composables/useMapSync.d.ts +16 -0
- package/dist/runtime/composables/useMapSync.js +42 -0
- package/dist/runtime/composables/useMaplibreCamera.d.ts +1 -1
- package/dist/runtime/composables/useMaplibreCamera.js +1 -1
- package/dist/runtime/composables/useMaplibreImage.d.ts +3 -3
- package/dist/runtime/composables/useMaplibreImage.js +26 -5
- package/dist/runtime/domains/map/config.js +2 -3
- package/dist/runtime/domains/map/context.js +15 -0
- package/dist/runtime/domains/map/control.d.ts +1 -1
- package/dist/runtime/domains/map/control.js +1 -1
- package/dist/runtime/domains/map/draw-modes.d.ts +9 -0
- package/dist/runtime/domains/map/draw-modes.js +53 -0
- package/dist/runtime/domains/map/draw-registry.d.ts +2 -3
- package/dist/runtime/domains/map/draw-registry.js +6 -9
- package/dist/runtime/domains/map/draw-theme.d.ts +12 -0
- package/dist/runtime/domains/map/draw-toolbar.js +11 -10
- package/dist/runtime/domains/map/layer-group.d.ts +15 -4
- package/dist/runtime/domains/map/layer-tree.d.ts +3 -0
- package/dist/runtime/domains/map/layer-tree.js +10 -0
- package/dist/runtime/domains/map/minimap.d.ts +18 -0
- package/dist/runtime/domains/map/minimap.js +86 -0
- package/dist/runtime/domains/map/registry.js +4 -3
- package/dist/runtime/domains/map/style-layers.d.ts +7 -0
- package/dist/runtime/domains/map/style-layers.js +54 -0
- package/dist/runtime/domains/map/style.d.ts +3 -0
- package/dist/runtime/domains/map/style.js +5 -0
- package/dist/runtime/domains/map/swipe.d.ts +9 -0
- package/dist/runtime/domains/map/swipe.js +62 -0
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/types/draw.d.ts +34 -1
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/layer.d.ts +40 -0
- package/dist/runtime/types/layer.js +0 -0
- package/dist/runtime/types/map.d.ts +6 -0
- package/dist/runtime/utils/cog.d.ts +2 -0
- package/dist/runtime/utils/cog.js +9 -0
- package/dist/runtime/utils/effects.js +2 -1
- package/dist/runtime/utils/events.d.ts +6 -0
- package/dist/runtime/utils/events.js +25 -0
- package/dist/runtime/utils/frame-icon.d.ts +2 -5
- package/dist/runtime/utils/frame-icon.js +10 -4
- package/dist/runtime/utils/graticule.d.ts +19 -0
- package/dist/runtime/utils/graticule.js +62 -0
- package/dist/runtime/utils/layer-opacity.d.ts +7 -0
- package/dist/runtime/utils/layer-opacity.js +59 -0
- package/dist/runtime/utils/layer.js +2 -1
- package/dist/runtime/utils/legend.d.ts +9 -0
- package/dist/runtime/utils/legend.js +52 -0
- package/dist/runtime/utils/marker.d.ts +11 -0
- package/dist/runtime/utils/marker.js +28 -0
- package/dist/runtime/utils/mask.d.ts +8 -0
- package/dist/runtime/utils/mask.js +33 -0
- package/dist/runtime/utils/minimap.d.ts +6 -0
- package/dist/runtime/utils/minimap.js +15 -0
- package/dist/runtime/utils/pmtiles.d.ts +3 -0
- package/dist/runtime/utils/pmtiles.js +10 -0
- package/dist/runtime/utils/source.d.ts +7 -0
- package/dist/runtime/utils/source.js +35 -0
- package/dist/runtime/utils/swipe.d.ts +32 -0
- package/dist/runtime/utils/swipe.js +18 -0
- package/dist/runtime/utils/tianditu.d.ts +10 -1
- package/dist/runtime/utils/tianditu.js +11 -0
- package/dist/runtime/utils/zzts-tile.d.ts +54 -0
- package/dist/runtime/utils/zzts-tile.js +85 -0
- package/dist/runtime/utils/zzts.d.ts +14 -0
- package/dist/runtime/utils/zzts.js +72 -0
- package/dist/unplugin.d.mts +1 -1
- package/dist/unplugin.d.ts +1 -1
- package/dist/unplugin.mjs +1 -7
- package/package.json +29 -21
- package/dist/runtime/draw-modes/index.d.ts +0 -16
- package/dist/runtime/draw-modes/index.js +0 -32
- package/dist/runtime/utils/draw-theme.d.ts +0 -47
- /package/dist/runtime/{utils → domains/map}/draw-theme.js +0 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { nextTick, shallowRef, useId, useTemplateRef } from "vue";
|
|
3
|
+
import { onClickOutside } from "@vueuse/core";
|
|
4
|
+
import { useControl } from "../../domains/map/control";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
position: { type: String, required: false },
|
|
7
|
+
group: { type: Boolean, required: false, default: true },
|
|
8
|
+
collapsible: { type: Boolean, required: false, default: false },
|
|
9
|
+
dismissible: { type: Boolean, required: false, default: true },
|
|
10
|
+
label: { type: String, required: false }
|
|
11
|
+
});
|
|
12
|
+
defineSlots();
|
|
13
|
+
const open = defineModel("open", { type: Boolean, ...{ default: false } });
|
|
14
|
+
const el = shallowRef();
|
|
15
|
+
const panelId = useId();
|
|
16
|
+
const trigger = useTemplateRef("trigger");
|
|
17
|
+
function createControl() {
|
|
18
|
+
let container;
|
|
19
|
+
return {
|
|
20
|
+
onAdd() {
|
|
21
|
+
container = document.createElement("div");
|
|
22
|
+
container.className = ["maplibregl-ctrl", props.group && "maplibregl-ctrl-group", "movk-maplibre-control"].filter(Boolean).join(" ");
|
|
23
|
+
el.value = container;
|
|
24
|
+
return container;
|
|
25
|
+
},
|
|
26
|
+
onRemove() {
|
|
27
|
+
container?.remove();
|
|
28
|
+
if (el.value === container) el.value = void 0;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
useControl(createControl, () => props.position, () => props.group);
|
|
33
|
+
function close() {
|
|
34
|
+
if (!open.value) return;
|
|
35
|
+
open.value = false;
|
|
36
|
+
nextTick(() => trigger.value?.focus());
|
|
37
|
+
}
|
|
38
|
+
onClickOutside(el, () => {
|
|
39
|
+
if (props.collapsible && props.dismissible && open.value) open.value = false;
|
|
40
|
+
});
|
|
41
|
+
function onKeydown(event) {
|
|
42
|
+
if (props.collapsible && event.key === "Escape") close();
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<template>
|
|
47
|
+
<Teleport v-if="el" :to="el">
|
|
48
|
+
<template v-if="collapsible">
|
|
49
|
+
<button
|
|
50
|
+
v-show="!open"
|
|
51
|
+
ref="trigger"
|
|
52
|
+
type="button"
|
|
53
|
+
class="movk-maplibre-control__trigger"
|
|
54
|
+
:aria-label="label"
|
|
55
|
+
:title="label"
|
|
56
|
+
:aria-expanded="open"
|
|
57
|
+
:aria-controls="panelId"
|
|
58
|
+
@click="open = true"
|
|
59
|
+
>
|
|
60
|
+
<slot name="trigger" />
|
|
61
|
+
</button>
|
|
62
|
+
<div
|
|
63
|
+
v-show="open"
|
|
64
|
+
:id="panelId"
|
|
65
|
+
class="movk-maplibre-control__panel"
|
|
66
|
+
@keydown="onKeydown"
|
|
67
|
+
>
|
|
68
|
+
<button
|
|
69
|
+
type="button"
|
|
70
|
+
class="movk-maplibre-control__close"
|
|
71
|
+
aria-label="Close"
|
|
72
|
+
title="Close"
|
|
73
|
+
@click="close"
|
|
74
|
+
>
|
|
75
|
+
<svg viewBox="0 0 24 24" width="12" height="12" aria-hidden="true">
|
|
76
|
+
<path
|
|
77
|
+
fill="none"
|
|
78
|
+
stroke="currentColor"
|
|
79
|
+
stroke-linecap="round"
|
|
80
|
+
stroke-linejoin="round"
|
|
81
|
+
stroke-width="2"
|
|
82
|
+
d="M18 6L6 18M6 6l12 12"
|
|
83
|
+
/>
|
|
84
|
+
</svg>
|
|
85
|
+
</button>
|
|
86
|
+
<slot />
|
|
87
|
+
</div>
|
|
88
|
+
</template>
|
|
89
|
+
<slot v-else />
|
|
90
|
+
</Teleport>
|
|
91
|
+
</template>
|
|
92
|
+
|
|
93
|
+
<style>
|
|
94
|
+
.movk-maplibre-control .movk-maplibre-control__trigger{align-items:center;background:transparent;border:0;color:#333;cursor:pointer;display:flex;height:29px;justify-content:center;padding:0;width:29px}.movk-maplibre-control .movk-maplibre-control__trigger:hover{background:rgba(0,0,0,.05)}:where(.movk-maplibre-control__panel){color:#333;font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;padding:8px 24px 8px 10px;position:relative}.movk-maplibre-control .movk-maplibre-control__close{align-items:center;background:transparent;border:0;border-radius:3px;color:#666;cursor:pointer;display:flex;height:18px;justify-content:center;padding:0;position:absolute;right:4px;top:4px;width:18px}.movk-maplibre-control .movk-maplibre-control__close:hover{background:rgba(0,0,0,.05);color:#333}
|
|
95
|
+
</style>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ControlPosition } from 'maplibre-gl';
|
|
2
|
+
/** 通用控件容器:把任意 Vue 内容挂到 maplibre 控件槽位,可选折叠为图标按钮。 */
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/** 控件停靠位置;省略用地图默认位置 */
|
|
5
|
+
position?: ControlPosition;
|
|
6
|
+
/**
|
|
7
|
+
* 是否使用 maplibre 控件组样式(白底圆角卡片)
|
|
8
|
+
* @defaultValue true
|
|
9
|
+
*/
|
|
10
|
+
group?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* 是否可折叠:收起时只显示触发按钮,点击展开,面板内关闭按钮或 Esc 收起
|
|
13
|
+
* @defaultValue false
|
|
14
|
+
*/
|
|
15
|
+
collapsible?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* 可折叠时点击控件外部是否收起;常驻展示的内容(如图例)应关闭
|
|
18
|
+
* @defaultValue true
|
|
19
|
+
*/
|
|
20
|
+
dismissible?: boolean;
|
|
21
|
+
/** 折叠按钮的无障碍标签 */
|
|
22
|
+
label?: string;
|
|
23
|
+
};
|
|
24
|
+
type __VLS_Slots = {
|
|
25
|
+
/** 控件内容;可折叠时为展开后的面板 */
|
|
26
|
+
default?: () => unknown;
|
|
27
|
+
/** 折叠按钮内容(通常是图标) */
|
|
28
|
+
trigger?: () => unknown;
|
|
29
|
+
};
|
|
30
|
+
type __VLS_ModelProps = {
|
|
31
|
+
/** 可折叠时的展开状态 */
|
|
32
|
+
'open'?: boolean;
|
|
33
|
+
};
|
|
34
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
35
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
36
|
+
"update:open": (value: boolean) => any;
|
|
37
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
38
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
39
|
+
}>, {
|
|
40
|
+
group: boolean;
|
|
41
|
+
collapsible: boolean;
|
|
42
|
+
dismissible: boolean;
|
|
43
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
44
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
45
|
+
declare const _default: typeof __VLS_export;
|
|
46
|
+
export default _default;
|
|
47
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
48
|
+
new (): {
|
|
49
|
+
$slots: S;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ControlPosition } from 'maplibre-gl';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** 控件停靠位置;省略用地图默认位置 */
|
|
4
|
+
position?: ControlPosition;
|
|
5
|
+
};
|
|
6
|
+
declare var __VLS_1: {};
|
|
7
|
+
type __VLS_Slots = {} & {
|
|
8
|
+
default?: (props: typeof __VLS_1) => any;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { GlobeControl } from "maplibre-gl";
|
|
3
|
+
import { useControl } from "../../domains/map/control";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
position: { type: String, required: false }
|
|
6
|
+
});
|
|
7
|
+
useControl(
|
|
8
|
+
() => new GlobeControl(),
|
|
9
|
+
() => props.position
|
|
10
|
+
);
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<slot />
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ControlPosition } from 'maplibre-gl';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** 控件停靠位置;省略用地图默认位置 */
|
|
4
|
+
position?: ControlPosition;
|
|
5
|
+
};
|
|
6
|
+
declare var __VLS_1: {};
|
|
7
|
+
type __VLS_Slots = {} & {
|
|
8
|
+
default?: (props: typeof __VLS_1) => any;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ControlPosition } from 'maplibre-gl';
|
|
2
|
+
import type { LayerTreeItem } from '../../types';
|
|
3
|
+
/** 图层控件:列出带 title 的 MaplibreLayerGroup,勾选控制显隐、滑块控制透明度,读写即写回各组的 v-model。 */
|
|
4
|
+
type __VLS_Props = {
|
|
5
|
+
/** 控件停靠位置;省略用地图默认位置 */
|
|
6
|
+
position?: ControlPosition;
|
|
7
|
+
/**
|
|
8
|
+
* 是否显示透明度滑块
|
|
9
|
+
* @defaultValue true
|
|
10
|
+
*/
|
|
11
|
+
opacity?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* 折叠按钮的无障碍标签
|
|
14
|
+
* @defaultValue 'Layers'
|
|
15
|
+
*/
|
|
16
|
+
label?: string;
|
|
17
|
+
};
|
|
18
|
+
type __VLS_Slots = {
|
|
19
|
+
/** 自定义单个图层组的行内容 */
|
|
20
|
+
item?: (props: {
|
|
21
|
+
item: LayerTreeItem;
|
|
22
|
+
}) => unknown;
|
|
23
|
+
};
|
|
24
|
+
type __VLS_ModelProps = {
|
|
25
|
+
/** 面板是否展开 */
|
|
26
|
+
'open'?: boolean;
|
|
27
|
+
};
|
|
28
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
29
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
30
|
+
"update:open": (value: boolean) => any;
|
|
31
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
32
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
33
|
+
}>, {
|
|
34
|
+
label: string;
|
|
35
|
+
opacity: boolean;
|
|
36
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
37
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
38
|
+
declare const _default: typeof __VLS_export;
|
|
39
|
+
export default _default;
|
|
40
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
41
|
+
new (): {
|
|
42
|
+
$slots: S;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useLayerTree } from "../../composables/useLayerTree";
|
|
3
|
+
import MaplibreControl from "./Control.vue";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
position: { type: String, required: false },
|
|
6
|
+
opacity: { type: Boolean, required: false, default: true },
|
|
7
|
+
label: { type: String, required: false, default: "Layers" }
|
|
8
|
+
});
|
|
9
|
+
defineSlots();
|
|
10
|
+
const open = defineModel("open", { type: Boolean, ...{ default: false } });
|
|
11
|
+
const items = useLayerTree();
|
|
12
|
+
function onToggle(item, event) {
|
|
13
|
+
item.setVisible(event.target.checked);
|
|
14
|
+
}
|
|
15
|
+
function onOpacity(item, event) {
|
|
16
|
+
item.setOpacity(Number(event.target.value));
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<MaplibreControl
|
|
22
|
+
v-model:open="open"
|
|
23
|
+
:position="position"
|
|
24
|
+
:label="label"
|
|
25
|
+
collapsible
|
|
26
|
+
>
|
|
27
|
+
<template #trigger>
|
|
28
|
+
<svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true">
|
|
29
|
+
<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
|
|
30
|
+
<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z" />
|
|
31
|
+
<path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12" />
|
|
32
|
+
<path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17" />
|
|
33
|
+
</g>
|
|
34
|
+
</svg>
|
|
35
|
+
</template>
|
|
36
|
+
<ul class="movk-maplibre-layer-control" :aria-label="label">
|
|
37
|
+
<li v-for="item in items" :key="item.id" class="movk-maplibre-layer-control__item">
|
|
38
|
+
<slot name="item" :item="item">
|
|
39
|
+
<label class="movk-maplibre-layer-control__toggle">
|
|
40
|
+
<input type="checkbox" :checked="item.visible" @change="onToggle(item, $event)">
|
|
41
|
+
<span class="movk-maplibre-layer-control__title">{{ item.title }}</span>
|
|
42
|
+
</label>
|
|
43
|
+
<input
|
|
44
|
+
v-if="props.opacity"
|
|
45
|
+
class="movk-maplibre-layer-control__opacity"
|
|
46
|
+
type="range"
|
|
47
|
+
min="0"
|
|
48
|
+
max="1"
|
|
49
|
+
step="0.05"
|
|
50
|
+
:value="item.opacity"
|
|
51
|
+
:disabled="!item.visible"
|
|
52
|
+
:aria-label="`${item.title} opacity`"
|
|
53
|
+
@input="onOpacity(item, $event)"
|
|
54
|
+
>
|
|
55
|
+
</slot>
|
|
56
|
+
</li>
|
|
57
|
+
</ul>
|
|
58
|
+
</MaplibreControl>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<style>
|
|
62
|
+
:where(.movk-maplibre-layer-control){display:flex;flex-direction:column;gap:6px;list-style:none;margin:0;min-width:160px;padding:0}:where(.movk-maplibre-layer-control__toggle){align-items:center;cursor:pointer;display:flex;gap:6px}:where(.movk-maplibre-layer-control__opacity){display:block;margin:2px 0 0;width:100%}
|
|
63
|
+
</style>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ControlPosition } from 'maplibre-gl';
|
|
2
|
+
import type { LayerTreeItem } from '../../types';
|
|
3
|
+
/** 图层控件:列出带 title 的 MaplibreLayerGroup,勾选控制显隐、滑块控制透明度,读写即写回各组的 v-model。 */
|
|
4
|
+
type __VLS_Props = {
|
|
5
|
+
/** 控件停靠位置;省略用地图默认位置 */
|
|
6
|
+
position?: ControlPosition;
|
|
7
|
+
/**
|
|
8
|
+
* 是否显示透明度滑块
|
|
9
|
+
* @defaultValue true
|
|
10
|
+
*/
|
|
11
|
+
opacity?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* 折叠按钮的无障碍标签
|
|
14
|
+
* @defaultValue 'Layers'
|
|
15
|
+
*/
|
|
16
|
+
label?: string;
|
|
17
|
+
};
|
|
18
|
+
type __VLS_Slots = {
|
|
19
|
+
/** 自定义单个图层组的行内容 */
|
|
20
|
+
item?: (props: {
|
|
21
|
+
item: LayerTreeItem;
|
|
22
|
+
}) => unknown;
|
|
23
|
+
};
|
|
24
|
+
type __VLS_ModelProps = {
|
|
25
|
+
/** 面板是否展开 */
|
|
26
|
+
'open'?: boolean;
|
|
27
|
+
};
|
|
28
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
29
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
30
|
+
"update:open": (value: boolean) => any;
|
|
31
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
32
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
33
|
+
}>, {
|
|
34
|
+
label: string;
|
|
35
|
+
opacity: boolean;
|
|
36
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
37
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
38
|
+
declare const _default: typeof __VLS_export;
|
|
39
|
+
export default _default;
|
|
40
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
41
|
+
new (): {
|
|
42
|
+
$slots: S;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ControlPosition } from 'maplibre-gl';
|
|
2
|
+
import type { LayerTreeItem, LegendItem } from '../../types';
|
|
3
|
+
/** 图例:展示可见图层组的图例项,图例来自 MaplibreLayerGroup 的 legend 或子图层颜色推导。 */
|
|
4
|
+
type __VLS_Props = {
|
|
5
|
+
/** 控件停靠位置;省略用地图默认位置 */
|
|
6
|
+
position?: ControlPosition;
|
|
7
|
+
/** 只展示这些标题的图层组;省略展示全部 */
|
|
8
|
+
groups?: string[];
|
|
9
|
+
/**
|
|
10
|
+
* 是否可折叠
|
|
11
|
+
* @defaultValue true
|
|
12
|
+
*/
|
|
13
|
+
collapsible?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* 折叠按钮与图例列表的无障碍标签
|
|
16
|
+
* @defaultValue 'Legend'
|
|
17
|
+
*/
|
|
18
|
+
label?: string;
|
|
19
|
+
};
|
|
20
|
+
type __VLS_Slots = {
|
|
21
|
+
/** 自定义单个图例项 */
|
|
22
|
+
item?: (props: {
|
|
23
|
+
item: LegendItem;
|
|
24
|
+
group: LayerTreeItem;
|
|
25
|
+
}) => unknown;
|
|
26
|
+
};
|
|
27
|
+
type __VLS_ModelProps = {
|
|
28
|
+
/** 可折叠时的展开状态 */
|
|
29
|
+
'open'?: boolean;
|
|
30
|
+
};
|
|
31
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
32
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
33
|
+
"update:open": (value: boolean) => any;
|
|
34
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
35
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
36
|
+
}>, {
|
|
37
|
+
label: string;
|
|
38
|
+
collapsible: boolean;
|
|
39
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
40
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
41
|
+
declare const _default: typeof __VLS_export;
|
|
42
|
+
export default _default;
|
|
43
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
44
|
+
new (): {
|
|
45
|
+
$slots: S;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { useLayerTree } from "../../composables/useLayerTree";
|
|
4
|
+
import MaplibreControl from "./Control.vue";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
position: { type: String, required: false },
|
|
7
|
+
groups: { type: Array, required: false },
|
|
8
|
+
collapsible: { type: Boolean, required: false, default: true },
|
|
9
|
+
label: { type: String, required: false, default: "Legend" }
|
|
10
|
+
});
|
|
11
|
+
defineSlots();
|
|
12
|
+
const open = defineModel("open", { type: Boolean, ...{ default: true } });
|
|
13
|
+
const tree = useLayerTree();
|
|
14
|
+
const entries = computed(() => tree.value.filter(
|
|
15
|
+
(group) => group.visible && group.legend.length > 0 && (!props.groups || props.groups.includes(group.title))
|
|
16
|
+
));
|
|
17
|
+
function isSingle(group) {
|
|
18
|
+
return group.legend.length === 1 && group.legend[0].label === group.title;
|
|
19
|
+
}
|
|
20
|
+
function swatchStyle(item) {
|
|
21
|
+
if (item.type === "gradient") return { background: `linear-gradient(to right, ${(item.colors ?? []).join(", ")})` };
|
|
22
|
+
return { background: item.color ?? "transparent" };
|
|
23
|
+
}
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<MaplibreControl
|
|
28
|
+
v-model:open="open"
|
|
29
|
+
:position="position"
|
|
30
|
+
:label="label"
|
|
31
|
+
:collapsible="collapsible"
|
|
32
|
+
:dismissible="false"
|
|
33
|
+
>
|
|
34
|
+
<template #trigger>
|
|
35
|
+
<svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true">
|
|
36
|
+
<path
|
|
37
|
+
fill="none"
|
|
38
|
+
stroke="currentColor"
|
|
39
|
+
stroke-linecap="round"
|
|
40
|
+
stroke-linejoin="round"
|
|
41
|
+
stroke-width="2"
|
|
42
|
+
d="M3 5h.01M3 12h.01M3 19h.01M8 5h13M8 12h13M8 19h13"
|
|
43
|
+
/>
|
|
44
|
+
</svg>
|
|
45
|
+
</template>
|
|
46
|
+
<div class="movk-maplibre-legend" :aria-label="label">
|
|
47
|
+
<section v-for="group in entries" :key="group.id" class="movk-maplibre-legend__group">
|
|
48
|
+
<p v-if="!isSingle(group)" class="movk-maplibre-legend__heading">
|
|
49
|
+
{{ group.title }}
|
|
50
|
+
</p>
|
|
51
|
+
<div v-for="item in group.legend" :key="`${item.label}-${item.color ?? item.colors?.join()}`" class="movk-maplibre-legend__row">
|
|
52
|
+
<slot name="item" :item="item" :group="group">
|
|
53
|
+
<span
|
|
54
|
+
class="movk-maplibre-legend__swatch"
|
|
55
|
+
:class="`movk-maplibre-legend__swatch--${item.type}`"
|
|
56
|
+
:style="swatchStyle(item)"
|
|
57
|
+
aria-hidden="true"
|
|
58
|
+
/>
|
|
59
|
+
<span>{{ item.label }}</span>
|
|
60
|
+
</slot>
|
|
61
|
+
</div>
|
|
62
|
+
</section>
|
|
63
|
+
</div>
|
|
64
|
+
</MaplibreControl>
|
|
65
|
+
</template>
|
|
66
|
+
|
|
67
|
+
<style>
|
|
68
|
+
:where(.movk-maplibre-legend){display:flex;flex-direction:column;gap:6px;min-width:120px}:where(.movk-maplibre-legend__heading){font-weight:600;margin:0}:where(.movk-maplibre-legend__row){align-items:center;display:flex;gap:6px}:where(.movk-maplibre-legend__swatch){border-radius:2px;flex:none;height:14px;width:14px}:where(.movk-maplibre-legend__swatch--line){border-radius:2px;height:3px}:where(.movk-maplibre-legend__swatch--circle){border-radius:9999px;height:10px;margin:0 2px;width:10px}:where(.movk-maplibre-legend__swatch--gradient){height:10px;width:48px}
|
|
69
|
+
</style>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ControlPosition } from 'maplibre-gl';
|
|
2
|
+
import type { LayerTreeItem, LegendItem } from '../../types';
|
|
3
|
+
/** 图例:展示可见图层组的图例项,图例来自 MaplibreLayerGroup 的 legend 或子图层颜色推导。 */
|
|
4
|
+
type __VLS_Props = {
|
|
5
|
+
/** 控件停靠位置;省略用地图默认位置 */
|
|
6
|
+
position?: ControlPosition;
|
|
7
|
+
/** 只展示这些标题的图层组;省略展示全部 */
|
|
8
|
+
groups?: string[];
|
|
9
|
+
/**
|
|
10
|
+
* 是否可折叠
|
|
11
|
+
* @defaultValue true
|
|
12
|
+
*/
|
|
13
|
+
collapsible?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* 折叠按钮与图例列表的无障碍标签
|
|
16
|
+
* @defaultValue 'Legend'
|
|
17
|
+
*/
|
|
18
|
+
label?: string;
|
|
19
|
+
};
|
|
20
|
+
type __VLS_Slots = {
|
|
21
|
+
/** 自定义单个图例项 */
|
|
22
|
+
item?: (props: {
|
|
23
|
+
item: LegendItem;
|
|
24
|
+
group: LayerTreeItem;
|
|
25
|
+
}) => unknown;
|
|
26
|
+
};
|
|
27
|
+
type __VLS_ModelProps = {
|
|
28
|
+
/** 可折叠时的展开状态 */
|
|
29
|
+
'open'?: boolean;
|
|
30
|
+
};
|
|
31
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
32
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
33
|
+
"update:open": (value: boolean) => any;
|
|
34
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
35
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
36
|
+
}>, {
|
|
37
|
+
label: string;
|
|
38
|
+
collapsible: boolean;
|
|
39
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
40
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
41
|
+
declare const _default: typeof __VLS_export;
|
|
42
|
+
export default _default;
|
|
43
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
44
|
+
new (): {
|
|
45
|
+
$slots: S;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ControlPosition, StyleSpecification } from 'maplibre-gl';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** 控件停靠位置;省略用地图默认位置 */
|
|
4
|
+
position?: ControlPosition;
|
|
5
|
+
/** 鹰眼底图样式(对象或样式 URL);省略时沿用主图样式并跟随其切换 */
|
|
6
|
+
mapStyle?: StyleSpecification | string;
|
|
7
|
+
/**
|
|
8
|
+
* 相对主图的缩放偏移
|
|
9
|
+
* @defaultValue -4
|
|
10
|
+
*/
|
|
11
|
+
zoomOffset?: number;
|
|
12
|
+
/**
|
|
13
|
+
* 宽度(px)
|
|
14
|
+
* @defaultValue 200
|
|
15
|
+
*/
|
|
16
|
+
width?: number;
|
|
17
|
+
/**
|
|
18
|
+
* 高度(px)
|
|
19
|
+
* @defaultValue 150
|
|
20
|
+
*/
|
|
21
|
+
height?: number;
|
|
22
|
+
/**
|
|
23
|
+
* 视口框颜色
|
|
24
|
+
* @defaultValue '#3b82f6'
|
|
25
|
+
*/
|
|
26
|
+
color?: string;
|
|
27
|
+
};
|
|
28
|
+
declare var __VLS_1: {};
|
|
29
|
+
type __VLS_Slots = {} & {
|
|
30
|
+
default?: (props: typeof __VLS_1) => any;
|
|
31
|
+
};
|
|
32
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
33
|
+
color: string;
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
zoomOffset: number;
|
|
37
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
38
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
39
|
+
declare const _default: typeof __VLS_export;
|
|
40
|
+
export default _default;
|
|
41
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
42
|
+
new (): {
|
|
43
|
+
$slots: S;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useControl } from "../../domains/map/control";
|
|
3
|
+
import { createMinimapControl } from "../../domains/map/minimap";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
position: { type: String, required: false },
|
|
6
|
+
mapStyle: { type: [Object, String], required: false },
|
|
7
|
+
zoomOffset: { type: Number, required: false, default: -4 },
|
|
8
|
+
width: { type: Number, required: false, default: 200 },
|
|
9
|
+
height: { type: Number, required: false, default: 150 },
|
|
10
|
+
color: { type: String, required: false, default: "#3b82f6" }
|
|
11
|
+
});
|
|
12
|
+
useControl(
|
|
13
|
+
() => createMinimapControl({
|
|
14
|
+
style: props.mapStyle,
|
|
15
|
+
zoomOffset: props.zoomOffset,
|
|
16
|
+
width: props.width,
|
|
17
|
+
height: props.height,
|
|
18
|
+
color: props.color
|
|
19
|
+
}),
|
|
20
|
+
() => props.position,
|
|
21
|
+
() => [props.mapStyle, props.zoomOffset, props.width, props.height, props.color]
|
|
22
|
+
);
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<slot />
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<style>
|
|
30
|
+
.movk-maplibre-minimap{cursor:pointer;overflow:hidden;touch-action:none}
|
|
31
|
+
</style>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ControlPosition, StyleSpecification } from 'maplibre-gl';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** 控件停靠位置;省略用地图默认位置 */
|
|
4
|
+
position?: ControlPosition;
|
|
5
|
+
/** 鹰眼底图样式(对象或样式 URL);省略时沿用主图样式并跟随其切换 */
|
|
6
|
+
mapStyle?: StyleSpecification | string;
|
|
7
|
+
/**
|
|
8
|
+
* 相对主图的缩放偏移
|
|
9
|
+
* @defaultValue -4
|
|
10
|
+
*/
|
|
11
|
+
zoomOffset?: number;
|
|
12
|
+
/**
|
|
13
|
+
* 宽度(px)
|
|
14
|
+
* @defaultValue 200
|
|
15
|
+
*/
|
|
16
|
+
width?: number;
|
|
17
|
+
/**
|
|
18
|
+
* 高度(px)
|
|
19
|
+
* @defaultValue 150
|
|
20
|
+
*/
|
|
21
|
+
height?: number;
|
|
22
|
+
/**
|
|
23
|
+
* 视口框颜色
|
|
24
|
+
* @defaultValue '#3b82f6'
|
|
25
|
+
*/
|
|
26
|
+
color?: string;
|
|
27
|
+
};
|
|
28
|
+
declare var __VLS_1: {};
|
|
29
|
+
type __VLS_Slots = {} & {
|
|
30
|
+
default?: (props: typeof __VLS_1) => any;
|
|
31
|
+
};
|
|
32
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
33
|
+
color: string;
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
zoomOffset: number;
|
|
37
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
38
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
39
|
+
declare const _default: typeof __VLS_export;
|
|
40
|
+
export default _default;
|
|
41
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
42
|
+
new (): {
|
|
43
|
+
$slots: S;
|
|
44
|
+
};
|
|
45
|
+
};
|