Skip to content

Commit

Permalink
docs(ol-view): use correct events
Browse files Browse the repository at this point in the history
  • Loading branch information
d-koppenhagen committed Sep 19, 2023
1 parent 8bb4912 commit 8527113
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions src/demos/ViewDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,24 @@
:rotation="rotation"
:zoom="zoom"
:projection="projection"
@zoomChanged="zoomChanged"
@centerChanged="centerChanged"
@resolutionChanged="resolutionChanged"
@rotationChanged="rotationChanged"
@change:center="centerChanged"
@change:resolution="resolutionChanged"
@change:rotation="rotationChanged"
/>

<ol-tile-layer>
<ol-source-osm />
</ol-tile-layer>

<ol-rotate-control></ol-rotate-control>
</ol-map>

<div>
center : {{ currentCenter }} zoom : {{ currentZoom }} resolution :
{{ currentResolution }} rotation : {{ currentRotation }}
</div>
<ul>
<li>center : {{ currentCenter }}</li>
<li>resolution : {{ currentResolution }}</li>
<li>zoom : {{ currentZoom }}</li>
<li>rotation : {{ currentRotation }}</li>
</ul>
</template>

<script setup>
Expand All @@ -31,21 +34,19 @@ const projection = ref("EPSG:4326");
const zoom = ref(8);
const rotation = ref(0);
const currentCenter = ref(0);
const currentZoom = ref(0);
const currentCenter = ref(center.value);
const currentZoom = ref(zoom.value);
const currentRotation = ref(rotation.value);
const currentResolution = ref(0);
const currentRotation = ref(0);
function zoomChanged(z) {
currentZoom.value = z;
}
function resolutionChanged(r) {
currentResolution.value = r;
function resolutionChanged(event) {
currentResolution.value = event.target.getResolution();
currentZoom.value = event.target.getZoom();
}
function centerChanged(c) {
currentCenter.value = c;
function centerChanged(event) {
currentCenter.value = event.target.getCenter();
}
function rotationChanged(r) {
currentRotation.value = r;
function rotationChanged(event) {
currentRotation.value = event.target.getRotation();
}
</script>

0 comments on commit 8527113

Please sign in to comment.