Skip to content

Commit deac3cf

Browse files
committed
refactor(ol-mouseposition-control): migrate to script setup
1 parent 6b61dff commit deac3cf

File tree

3 files changed

+43
-44
lines changed

3 files changed

+43
-44
lines changed

src/components/mapControls/MousePositionControl.vue

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<template lang="">
2+
<div v-if="false"></div>
3+
</template>
4+
5+
<script setup>
6+
import { MousePosition } from "ol/control";
7+
import useControl from "@/composables/useControl";
8+
import { useAttrs } from "vue";
9+
10+
const props = defineProps({
11+
className: {
12+
type: String,
13+
default: "ol-mouse-position",
14+
},
15+
coordinateFormat: {
16+
type: [String, Function],
17+
},
18+
projection: {
19+
type: String,
20+
},
21+
render: {
22+
type: Function,
23+
},
24+
target: {
25+
type: HTMLElement,
26+
},
27+
placeholder: {
28+
type: String,
29+
},
30+
});
31+
32+
const attrs = useAttrs();
33+
const { control } = useControl(MousePosition, props, { attrs });
34+
35+
defineExpose({
36+
control,
37+
});
38+
</script>
39+
40+
<style lang=""></style>

src/components/mapControls/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import OlControlBar from "./OlControlBar.vue";
55
import OlFullScreenControl from "./OlFullScreenControl.vue";
66
import OlLayerSwitcherControl from "./OlLayerSwitcherControl.vue";
77
import OlLayerSwitcherImageControl from "./OlLayerSwitcherImageControl.vue";
8-
import MousePositionControl from "./MousePositionControl.vue";
8+
import OlMousePositionControl from "./OlMousePositionControl.vue";
99
import OverviewMapControl from "./OverviewMapControl.vue";
1010
import ScaleLineControl from "./ScaleLineControl.vue";
1111
import ZoomControl from "./ZoomControl.vue";
@@ -27,7 +27,7 @@ function install(app) {
2727

2828
app.component("ol-attribution-control", OlAttributionControl);
2929
app.component("ol-fullscreen-control", OlFullScreenControl);
30-
app.component(MousePositionControl.name, MousePositionControl);
30+
app.component("ol-mouseposition-control", OlMousePositionControl);
3131
app.component(OverviewMapControl.name, OverviewMapControl);
3232
app.component(ScaleLineControl.name, ScaleLineControl);
3333
app.component(ZoomControl.name, ZoomControl);
@@ -57,7 +57,7 @@ export {
5757
OlFullScreenControl,
5858
OlLayerSwitcherControl,
5959
OlLayerSwitcherImageControl,
60-
MousePositionControl,
60+
OlMousePositionControl,
6161
OverviewMapControl,
6262
ScaleLineControl,
6363
ZoomControl,

0 commit comments

Comments
 (0)