Skip to content

Commit b3a4f68

Browse files
committed
refactor(ol-scaleline-control): migrate to script setup
1 parent f25354d commit b3a4f68

File tree

3 files changed

+60
-61
lines changed

3 files changed

+60
-61
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<template lang="">
2+
<div v-if="false"></div>
3+
</template>
4+
5+
<script setup>
6+
import useControl from "@/composables/useControl";
7+
8+
import { ScaleLine } from "ol/control";
9+
import { useAttrs } from "vue";
10+
11+
const props = defineProps({
12+
className: {
13+
type: String,
14+
default: "ol-scale-line",
15+
},
16+
minWidth: {
17+
type: Number,
18+
default: 64,
19+
},
20+
render: {
21+
type: Function,
22+
},
23+
target: {
24+
type: HTMLElement,
25+
},
26+
units: {
27+
type: String,
28+
default: "metric",
29+
},
30+
bar: {
31+
type: Boolean,
32+
default: false,
33+
},
34+
35+
steps: {
36+
type: Number,
37+
default: 4,
38+
},
39+
text: {
40+
type: Boolean,
41+
default: false,
42+
},
43+
dpi: {
44+
type: Number,
45+
default: undefined,
46+
},
47+
});
48+
49+
const attrs = useAttrs();
50+
const { control } = useControl(ScaleLine, props, { attrs });
51+
52+
defineExpose({
53+
control,
54+
});
55+
</script>
56+
57+
<style lang=""></style>

src/components/mapControls/ScaleLineControl.vue

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

src/components/mapControls/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import OlMousePositionControl from "./OlMousePositionControl.vue";
99
import OlOverviewMapControl from "./OlOverviewMapControl.vue";
1010
import OlPrintDialogControl from "./OlPrintDialogControl.vue";
1111
import OlRotateControl from "./OlRotateControl.vue";
12-
import ScaleLineControl from "./ScaleLineControl.vue";
12+
import OlScaleLineControl from "./OlScaleLineControl.vue";
1313
import ZoomControl from "./ZoomControl.vue";
1414
import ZoomSliderControl from "./ZoomSliderControl.vue";
1515
import ZoomToExtentControl from "./ZoomToExtentControl.vue";
@@ -29,7 +29,7 @@ function install(app) {
2929
app.component("ol-fullscreen-control", OlFullScreenControl);
3030
app.component("ol-mouseposition-control", OlMousePositionControl);
3131
app.component("ol-overviewmap-control", OlOverviewMapControl);
32-
app.component(ScaleLineControl.name, ScaleLineControl);
32+
app.component("ol-scaleline-control", OlScaleLineControl);
3333
app.component(ZoomControl.name, ZoomControl);
3434
app.component(ZoomSliderControl.name, ZoomSliderControl);
3535
app.component(ZoomToExtentControl.name, ZoomToExtentControl);
@@ -61,7 +61,7 @@ export {
6161
OlOverviewMapControl,
6262
OlPrintDialogControl,
6363
OlRotateControl,
64-
ScaleLineControl,
64+
OlScaleLineControl,
6565
ZoomControl,
6666
ZoomSliderControl,
6767
ZoomToExtentControl,

0 commit comments

Comments
 (0)