Skip to content

Commit 57c9a95

Browse files
committed
fix(ol-view): re-enable rotation
1 parent 96a6078 commit 57c9a95

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

docs/componentsguide/view/index.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ This deviating props are described in the section below.
3434

3535
### Deviating Properties
3636

37-
None.
37+
### `enableRotation`
38+
39+
Rotation is enabled by default.
40+
Setting this to `false` prevents from any rotation even when the property `rotation` is set or by using methods such ad `adjustRotation` or `setRotation`.
3841

3942
## Events
4043

src/components/map/OlView.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ defineOptions({
2222
inheritAttrs: false,
2323
});
2424
25-
const props = defineProps<ViewOptions>();
25+
const props = withDefaults(defineProps<ViewOptions>(), {
26+
enableRotation: true,
27+
});
2628
2729
const map = inject<Map>("map");
2830
const { properties } = usePropsAsObjectProperties(props);

src/demos/RotateControlDemo.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
Rotate right
44
</button>
55
<ol-map style="height: 400px">
6-
<ol-view
7-
:center="center"
8-
:rotation="rotation"
9-
:zoom="zoom"
10-
:projection="projection"
11-
/>
6+
<ol-view ref="viewRef" :center="center" :zoom="zoom" :rotation="rotation" />
127

138
<ol-tile-layer>
149
<ol-source-osm />
@@ -19,7 +14,12 @@
1914

2015
<script setup>
2116
import { ref } from "vue";
22-
const center = ref([40, 40]);
23-
const projection = ref("EPSG:4326");
24-
const zoom = ref(8);
17+
const center = ref([14200000, 4130000]);
18+
const zoom = ref(6);
19+
const viewRef = ref(null);
20+
const rotation = ref(Math.PI / 6);
21+
22+
function rotateRight() {
23+
viewRef.value?.adjustRotation(0.1);
24+
}
2525
</script>

0 commit comments

Comments
 (0)