Skip to content

Commit

Permalink
closes #26,closes #30 baseLayer prop is added to all layer and bug fi…
Browse files Browse the repository at this point in the history
…x for dublicate ol-control-toggle
  • Loading branch information
MelihAltintas committed Sep 12, 2021
1 parent b19ea31 commit 1bc722d
Show file tree
Hide file tree
Showing 24 changed files with 97 additions and 56 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue3-openlayers",
"version": "0.1.44",
"version": "0.1.45",
"description": "Openlayers Wrapper for Vue3",
"repository": {
"type": "git",
Expand Down
17 changes: 9 additions & 8 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
<ol-source-xyz crossOrigin='anonymous' url="https://c.tile.jawg.io/jawg-dark/{z}/{x}/{y}.png?access-token=87PWIbRaZAGNmYDjlYsLkeTVJpQeCfl2Y61mcHopxXqSdxXExoTLEv7dwqBwSWuJ" />
</ol-tile-layer>

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

</ol-control-videorecorder>
<ol-control-printdialog />
<ol-control-printdialog :order="5" />
</ol-control-bar>

<ol-mouseposition-control />
Expand Down Expand Up @@ -175,7 +175,6 @@ export default {
const projection = ref('EPSG:4326')
const zoom = ref(6)
const rotation = ref(0)
const format = inject('ol-format');
const geoJson = new format.GeoJSON();
Expand Down Expand Up @@ -326,9 +325,11 @@ export default {
layerList.value.push(osmLayer.value.tileLayer);
console.log(layerList.value)
console.log(animationPath.value)
});
return {
center,
projection,
zoom,
Expand Down
6 changes: 5 additions & 1 deletion src/components/layers/AnimatedClusterLayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ export default {
preview: {
type: String,
}
},
baseLayer: {
type: Boolean,
},
}
}
</script>
Expand Down
6 changes: 5 additions & 1 deletion src/components/layers/ImageLayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ export default {
preview: {
type: String,
}
},
baseLayer: {
type: Boolean,
},
}
}
</script>
Expand Down
6 changes: 5 additions & 1 deletion src/components/layers/TileLayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ export default {
preview: {
type: String,
}
},
baseLayer:{
type: Boolean,
},
}
}
</script>
Expand Down
6 changes: 5 additions & 1 deletion src/components/layers/VectorLayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ export default {
preview: {
type: String,
}
},
baseLayer: {
type: Boolean,
},
}
}
</script>
Expand Down
4 changes: 2 additions & 2 deletions src/components/mapControls/AttributionControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import useControl from '@/composables/useControl'
export default {
name: 'ol-attribution-control',
setup(props) {
setup(props,context) {
const {
control
} = useControl(Attribution, props);
} = useControl(Attribution, props,context);
return {
control
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/mapControls/ContextMenuControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import useControl from '@/composables/useControl'
export default {
name: 'ol-context-menu',
setup(props) {
setup(props,context) {
const {
control
} = useControl(ContextMenu, props);
} = useControl(ContextMenu, props,context);
return {
control
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/mapControls/ControlBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import useControl from '@/composables/useControl'
import {provide} from "vue"
export default {
name: 'ol-control-bar',
setup(props) {
setup(props,context) {
const {
control
} = useControl(Bar, props);
} = useControl(Bar, props,context);
provide('controlBar',control)
return {
Expand Down
4 changes: 2 additions & 2 deletions src/components/mapControls/FullScreenControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import useControl from '@/composables/useControl'
export default {
name: 'ol-fullscreen-control',
setup(props) {
setup(props,context) {
const {
control
} = useControl(FullScreen, props);
} = useControl(FullScreen, props,context);
return {
control
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/mapControls/LayerSwitcherControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import useControl from '@/composables/useControl'
export default {
name: 'ol-layerswitcher-control',
setup(props) {
setup(props,context) {
const {
control
} = useControl(LayerSwitcher, props);
} = useControl(LayerSwitcher, props,context);
return {
control
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/mapControls/LayerSwitcherImageControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import LayerSwitcherControl from './LayerSwitcherControl'
export default {
name: 'ol-layerswitcherimage-control',
extends: LayerSwitcherControl,
setup(props) {
setup(props,context) {
const {
control
} = useControl(LayerSwitcherImage, props);
} = useControl(LayerSwitcherImage, props,context);
return {
control
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/mapControls/MousePositionControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import useControl from '@/composables/useControl'
export default {
name: 'ol-mouseposition-control',
setup(props) {
setup(props,context) {
const {
control
} = useControl(MousePosition, props);
} = useControl(MousePosition, props,context);
return {
control
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/mapControls/OverviewMapControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ import {
} from 'vue'
export default {
name: 'ol-overviewmap-control',
setup(props) {
setup(props,context) {
const map = inject('map');
const {
control
} = useControl(OverviewMap, props);
} = useControl(OverviewMap, props,context);
onMounted(() => {
control.value.setMap(map);
Expand Down
4 changes: 2 additions & 2 deletions src/components/mapControls/PrintDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import { jsPDF } from "jspdf";
export default {
name: 'ol-control-printdialog',
setup(props) {
setup(props,context) {
const {
control
} = useControl(PrintDialog, props);
} = useControl(PrintDialog, props,context);
control.value.on(['print','error'], function (e) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/mapControls/RotateControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import Rotate from 'ol/control/Rotate';
export default {
name: 'ol-rotate-control',
setup(props) {
setup(props,context) {
const {
control
} = useControl(Rotate, props);
} = useControl(Rotate, props,context);
return {
control
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/mapControls/ScaleLineControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import {
export default {
name: 'ol-scaleline-control',
setup(props) {
setup(props,context) {
const {
control
} = useControl(ScaleLine, props);
} = useControl(ScaleLine, props,context);
return {
control
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/mapControls/SwipeControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import {
} from "vue"
export default {
name: 'ol-swipe-control',
setup(props) {
setup(props,context) {
const {
control
} = useControl(Swipe, props);
} = useControl(Swipe, props,context);
const {
layerList
Expand Down
6 changes: 2 additions & 4 deletions src/components/mapControls/ToggleControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
import Toggle from 'ol-ext/control/Toggle'
import useControl from '@/composables/useControl'
export default {
name: 'ol-control-toggle',
setup(props) {
setup(props,context) {
const {
control
} = useControl(Toggle, props);
} = useControl(Toggle, props,context);
return {
control
Expand All @@ -37,7 +36,6 @@ export default {
onToggle: {
type: Function,
},
}
}
</script>
Expand Down
10 changes: 4 additions & 6 deletions src/components/mapControls/VideoRecorderControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,22 @@ import {toRefs} from 'vue'
export default {
name: 'ol-control-videorecorder',
emits: ['start', 'stop'],
setup(props, {
emit
}) {
setup(props, context) {
const {
control
} =
useControl(VideoRecorder, props);
useControl(VideoRecorder, props,context);
const{downloadName} = toRefs(props)
control.value.on("start", (event) => {
emit('start', event)
context.emit('start', event)
})
control.value.on("stop", (event) => {
emit('stop', event)
context.emit('stop', event)
saveAs(event.videoURL, downloadName.value);
})
return {
Expand Down
4 changes: 2 additions & 2 deletions src/components/mapControls/ZoomControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import useControl from '@/composables/useControl'
export default {
name: 'ol-zoom-control',
setup(props) {
setup(props,context) {
const {
control
} = useControl(Zoom, props);
} = useControl(Zoom, props,context);
return {
control
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/mapControls/ZoomSliderControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import ZoomSlider from 'ol/control/ZoomSlider';
export default {
name: 'ol-zoomslider-control',
setup(props) {
setup(props,context) {
const {
control
} = useControl(ZoomSlider, props);
} = useControl(ZoomSlider, props,context);
return {
control
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/mapControls/ZoomToExtentControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import ZoomToExtent from 'ol/control/ZoomToExtent';
export default {
name: 'ol-zoomtoextent-control',
setup(props) {
setup(props,context) {
const {
control
} = useControl(ZoomToExtent, props);
} = useControl(ZoomToExtent, props,context);
return {
control
}
Expand Down
Loading

0 comments on commit 1bc722d

Please sign in to comment.