Skip to content

Commit 1bc722d

Browse files
committed
closes #26,closes #30 baseLayer prop is added to all layer and bug fix for dublicate ol-control-toggle
1 parent b19ea31 commit 1bc722d

24 files changed

+97
-56
lines changed

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue3-openlayers",
3-
"version": "0.1.44",
3+
"version": "0.1.45",
44
"description": "Openlayers Wrapper for Vue3",
55
"repository": {
66
"type": "git",

Diff for: src/App.vue

+9-8
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
<ol-source-xyz crossOrigin='anonymous' url="https://c.tile.jawg.io/jawg-dark/{z}/{x}/{y}.png?access-token=87PWIbRaZAGNmYDjlYsLkeTVJpQeCfl2Y61mcHopxXqSdxXExoTLEv7dwqBwSWuJ" />
1616
</ol-tile-layer>
1717

18-
<ol-control-bar>
19-
<ol-control-toggle html="<i class='fas fa-map-marker'></i>" className="edit" title="Point" :onToggle="(active)=>changeDrawType(active,'Point')" />
20-
<ol-control-toggle html="<i class='fas fa-draw-polygon'></i>" className="edit" title="Polygon" :onToggle="(active)=>changeDrawType(active,'Polygon')" />
21-
<ol-control-toggle html="<i class='fas fa-circle'></i>" className="edit" title="Circle" :onToggle="(active)=>changeDrawType(active,'Circle')" />
22-
<ol-control-toggle html="<i class='fas fa-grip-lines'></i>" className="edit" title="LineString" :onToggle="(active)=>changeDrawType(active,'LineString')" />
23-
<ol-control-videorecorder @stop="videoStopped">
18+
<ol-control-bar >
19+
<ol-control-toggle :order="0" html="<i class='fas fa-map-marker'></i>" className="edit" title="Point" :onToggle="(active)=>changeDrawType(active,'Point')" />
20+
<ol-control-toggle :order="1" html="<i class='fas fa-draw-polygon'></i>" className="edit" title="Polygon" :onToggle="(active)=>changeDrawType(active,'Polygon')" />
21+
<ol-control-toggle :order="2" html="<i class='fas fa-circle'></i>" className="edit" title="Circle" :onToggle="(active)=>changeDrawType(active,'Circle')" />
22+
<ol-control-toggle :order="3" html="<i class='fas fa-grip-lines'></i>" className="edit" title="LineString" :onToggle="(active)=>changeDrawType(active,'LineString')" />
23+
<ol-control-videorecorder :order="4" @stop="videoStopped">
2424

2525
</ol-control-videorecorder>
26-
<ol-control-printdialog />
26+
<ol-control-printdialog :order="5" />
2727
</ol-control-bar>
2828

2929
<ol-mouseposition-control />
@@ -175,7 +175,6 @@ export default {
175175
const projection = ref('EPSG:4326')
176176
const zoom = ref(6)
177177
const rotation = ref(0)
178-
179178
const format = inject('ol-format');
180179
181180
const geoJson = new format.GeoJSON();
@@ -326,9 +325,11 @@ export default {
326325
layerList.value.push(osmLayer.value.tileLayer);
327326
console.log(layerList.value)
328327
console.log(animationPath.value)
328+
329329
});
330330
331331
return {
332+
332333
center,
333334
projection,
334335
zoom,

Diff for: src/components/layers/AnimatedClusterLayer.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ export default {
105105
preview: {
106106
type: String,
107107
108-
}
108+
},
109+
baseLayer: {
110+
type: Boolean,
111+
112+
},
109113
}
110114
}
111115
</script>

Diff for: src/components/layers/ImageLayer.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@ export default {
8585
preview: {
8686
type: String,
8787
88-
}
88+
},
89+
baseLayer: {
90+
type: Boolean,
91+
92+
},
8993
}
9094
}
9195
</script>

Diff for: src/components/layers/TileLayer.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,11 @@ export default {
117117
preview: {
118118
type: String,
119119
120-
}
120+
},
121+
baseLayer:{
122+
type: Boolean,
123+
124+
},
121125
}
122126
}
123127
</script>

Diff for: src/components/layers/VectorLayer.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@ export default {
106106
preview: {
107107
type: String,
108108
109-
}
109+
},
110+
baseLayer: {
111+
type: Boolean,
112+
113+
},
110114
}
111115
}
112116
</script>

Diff for: src/components/mapControls/AttributionControl.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import useControl from '@/composables/useControl'
1212
1313
export default {
1414
name: 'ol-attribution-control',
15-
setup(props) {
15+
setup(props,context) {
1616
const {
1717
control
18-
} = useControl(Attribution, props);
18+
} = useControl(Attribution, props,context);
1919
return {
2020
control
2121
}

Diff for: src/components/mapControls/ContextMenuControl.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import useControl from '@/composables/useControl'
1212
1313
export default {
1414
name: 'ol-context-menu',
15-
setup(props) {
15+
setup(props,context) {
1616
const {
1717
control
18-
} = useControl(ContextMenu, props);
18+
} = useControl(ContextMenu, props,context);
1919
return {
2020
control
2121
}

Diff for: src/components/mapControls/ControlBar.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import useControl from '@/composables/useControl'
1010
import {provide} from "vue"
1111
export default {
1212
name: 'ol-control-bar',
13-
setup(props) {
13+
setup(props,context) {
1414
const {
1515
control
16-
} = useControl(Bar, props);
16+
} = useControl(Bar, props,context);
1717
1818
provide('controlBar',control)
1919
return {

Diff for: src/components/mapControls/FullScreenControl.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ import useControl from '@/composables/useControl'
1313
1414
export default {
1515
name: 'ol-fullscreen-control',
16-
setup(props) {
16+
setup(props,context) {
1717
1818
const {
1919
control
20-
} = useControl(FullScreen, props);
20+
} = useControl(FullScreen, props,context);
2121
return {
2222
control
2323
}

Diff for: src/components/mapControls/LayerSwitcherControl.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import useControl from '@/composables/useControl'
1010
1111
export default {
1212
name: 'ol-layerswitcher-control',
13-
setup(props) {
13+
setup(props,context) {
1414
const {
1515
control
16-
} = useControl(LayerSwitcher, props);
16+
} = useControl(LayerSwitcher, props,context);
1717
return {
1818
control
1919
}

Diff for: src/components/mapControls/LayerSwitcherImageControl.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import LayerSwitcherControl from './LayerSwitcherControl'
1111
export default {
1212
name: 'ol-layerswitcherimage-control',
1313
extends: LayerSwitcherControl,
14-
setup(props) {
14+
setup(props,context) {
1515
const {
1616
control
17-
} = useControl(LayerSwitcherImage, props);
17+
} = useControl(LayerSwitcherImage, props,context);
1818
return {
1919
control
2020
}

Diff for: src/components/mapControls/MousePositionControl.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import useControl from '@/composables/useControl'
1313
1414
export default {
1515
name: 'ol-mouseposition-control',
16-
setup(props) {
16+
setup(props,context) {
1717
const {
1818
control
19-
} = useControl(MousePosition, props);
19+
} = useControl(MousePosition, props,context);
2020
return {
2121
control
2222
}

Diff for: src/components/mapControls/OverviewMapControl.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ import {
1717
} from 'vue'
1818
export default {
1919
name: 'ol-overviewmap-control',
20-
setup(props) {
20+
setup(props,context) {
2121
2222
const map = inject('map');
2323
2424
const {
2525
control
26-
} = useControl(OverviewMap, props);
26+
} = useControl(OverviewMap, props,context);
2727
2828
onMounted(() => {
2929
control.value.setMap(map);

Diff for: src/components/mapControls/PrintDialog.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import { jsPDF } from "jspdf";
1414
1515
export default {
1616
name: 'ol-control-printdialog',
17-
setup(props) {
17+
setup(props,context) {
1818
const {
1919
control
20-
} = useControl(PrintDialog, props);
20+
} = useControl(PrintDialog, props,context);
2121
2222
control.value.on(['print','error'], function (e) {
2323

Diff for: src/components/mapControls/RotateControl.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import Rotate from 'ol/control/Rotate';
1010
1111
export default {
1212
name: 'ol-rotate-control',
13-
setup(props) {
13+
setup(props,context) {
1414
const {
1515
control
16-
} = useControl(Rotate, props);
16+
} = useControl(Rotate, props,context);
1717
return {
1818
control
1919
}

Diff for: src/components/mapControls/ScaleLineControl.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import {
1313
1414
export default {
1515
name: 'ol-scaleline-control',
16-
setup(props) {
16+
setup(props,context) {
1717
const {
1818
control
19-
} = useControl(ScaleLine, props);
19+
} = useControl(ScaleLine, props,context);
2020
return {
2121
control
2222
}

Diff for: src/components/mapControls/SwipeControl.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import {
1212
} from "vue"
1313
export default {
1414
name: 'ol-swipe-control',
15-
setup(props) {
15+
setup(props,context) {
1616
const {
1717
control
18-
} = useControl(Swipe, props);
18+
} = useControl(Swipe, props,context);
1919
2020
const {
2121
layerList

Diff for: src/components/mapControls/ToggleControl.vue

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88
import Toggle from 'ol-ext/control/Toggle'
99
1010
import useControl from '@/composables/useControl'
11-
1211
export default {
1312
name: 'ol-control-toggle',
14-
setup(props) {
13+
setup(props,context) {
1514
const {
1615
control
17-
} = useControl(Toggle, props);
16+
} = useControl(Toggle, props,context);
1817
1918
return {
2019
control
@@ -37,7 +36,6 @@ export default {
3736
onToggle: {
3837
type: Function,
3938
},
40-
4139
}
4240
}
4341
</script>

Diff for: src/components/mapControls/VideoRecorderControl.vue

+4-6
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,22 @@ import {toRefs} from 'vue'
1414
export default {
1515
name: 'ol-control-videorecorder',
1616
emits: ['start', 'stop'],
17-
setup(props, {
18-
emit
19-
}) {
17+
setup(props, context) {
2018
2119
const {
2220
control
2321
} =
24-
useControl(VideoRecorder, props);
22+
useControl(VideoRecorder, props,context);
2523
2624
const{downloadName} = toRefs(props)
2725
2826
control.value.on("start", (event) => {
29-
emit('start', event)
27+
context.emit('start', event)
3028
3129
})
3230
3331
control.value.on("stop", (event) => {
34-
emit('stop', event)
32+
context.emit('stop', event)
3533
saveAs(event.videoURL, downloadName.value);
3634
})
3735
return {

Diff for: src/components/mapControls/ZoomControl.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import useControl from '@/composables/useControl'
1010
1111
export default {
1212
name: 'ol-zoom-control',
13-
setup(props) {
13+
setup(props,context) {
1414
const {
1515
control
16-
} = useControl(Zoom, props);
16+
} = useControl(Zoom, props,context);
1717
return {
1818
control
1919
}

Diff for: src/components/mapControls/ZoomSliderControl.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import ZoomSlider from 'ol/control/ZoomSlider';
1010
1111
export default {
1212
name: 'ol-zoomslider-control',
13-
setup(props) {
13+
setup(props,context) {
1414
1515
const {
1616
control
17-
} = useControl(ZoomSlider, props);
17+
} = useControl(ZoomSlider, props,context);
1818
return {
1919
control
2020
}

Diff for: src/components/mapControls/ZoomToExtentControl.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import ZoomToExtent from 'ol/control/ZoomToExtent';
1111
1212
export default {
1313
name: 'ol-zoomtoextent-control',
14-
setup(props) {
14+
setup(props,context) {
1515
const {
1616
control
17-
} = useControl(ZoomToExtent, props);
17+
} = useControl(ZoomToExtent, props,context);
1818
return {
1919
control
2020
}

0 commit comments

Comments
 (0)