Skip to content

Commit 639dffc

Browse files
committed
refactor(ol-zoom-control): migrate to script setup
1 parent d3a481d commit 639dffc

File tree

3 files changed

+63
-64
lines changed

3 files changed

+63
-64
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<template lang="">
2+
<div v-if="false"></div>
3+
</template>
4+
5+
<script setup>
6+
import Zoom from "ol/control/Zoom";
7+
import useControl from "@/composables/useControl";
8+
import { useAttrs } from "vue";
9+
10+
const props = defineProps({
11+
duration: {
12+
type: Number,
13+
default: 250,
14+
},
15+
className: {
16+
type: String,
17+
default: "ol-zoom",
18+
},
19+
zoomInClassName: {
20+
type: String,
21+
default: "ol-zoom-in",
22+
},
23+
zoomOutClassName: {
24+
type: String,
25+
default: "ol-zoom-out",
26+
},
27+
zoomInLabel: {
28+
type: String,
29+
default: "+",
30+
},
31+
zoomOutLabel: {
32+
type: String,
33+
default: "-",
34+
},
35+
zoomInTipLabel: {
36+
type: String,
37+
default: "Zoom in",
38+
},
39+
zoomOutTipLabel: {
40+
type: String,
41+
default: "Zoom Out",
42+
},
43+
delta: {
44+
type: Number,
45+
default: 1,
46+
},
47+
target: {
48+
type: HTMLElement,
49+
},
50+
});
51+
52+
const attrs = useAttrs();
53+
const { control } = useControl(Zoom, props, { attrs });
54+
55+
defineExpose({
56+
control,
57+
});
58+
</script>
59+
60+
<style lang=""></style>

src/components/mapControls/ZoomControl.vue

Lines changed: 0 additions & 61 deletions
This file was deleted.

src/components/mapControls/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import OlSwipeControl from "./OlSwipeControl.vue";
1414
import OlToggleControl from "./OlToggleControl.vue";
1515
import OlVideoRecorderControl from "./OlVideoRecorderControl.vue";
1616
import OlZoneControl from "./OlZoneControl.vue";
17-
import ZoomControl from "./ZoomControl.vue";
17+
import OlZoomControl from "./OlZoomControl.vue";
1818
import ZoomSliderControl from "./ZoomSliderControl.vue";
1919
import ZoomToExtentControl from "./ZoomToExtentControl.vue";
2020

@@ -30,7 +30,7 @@ function install(app) {
3030
app.component("ol-mouseposition-control", OlMousePositionControl);
3131
app.component("ol-overviewmap-control", OlOverviewMapControl);
3232
app.component("ol-scaleline-control", OlScaleLineControl);
33-
app.component(ZoomControl.name, ZoomControl);
33+
app.component("ol-zoom-control", OlZoomControl);
3434
app.component(ZoomSliderControl.name, ZoomSliderControl);
3535
app.component(ZoomToExtentControl.name, ZoomToExtentControl);
3636
app.component("ol-rotate-control", OlRotateControl);
@@ -66,7 +66,7 @@ export {
6666
OlToggleControl,
6767
OlVideoRecorderControl,
6868
OlZoneControl,
69-
ZoomControl,
69+
OlZoomControl,
7070
ZoomSliderControl,
7171
ZoomToExtentControl,
7272
};

0 commit comments

Comments
 (0)