Skip to content

Commit 8846176

Browse files
committed
feat(ol-interaction-mouse-wheel-zoom): provide new interaction to disable / customize mouse zoom behavior
closes #356
1 parent cf67e75 commit 8846176

File tree

16 files changed

+201
-26
lines changed

16 files changed

+201
-26
lines changed

docs/.vitepress/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,10 @@ export const config: UserConfig = {
384384
text: "ol-interaction-modify",
385385
link: "/componentsguide/interactions/modify/",
386386
},
387+
{
388+
text: "ol-interaction-mouse-wheel-zoom",
389+
link: "/componentsguide/interactions/mousewheelzoom/",
390+
},
387391
{
388392
text: "ol-interaction-pointer",
389393
link: "/componentsguide/interactions/pointer/",

docs/componentsguide/animations.plugin.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ import { createApp } from "vue";
1010
import App from "./App.vue";
1111

1212
import {
13-
// [!code focus:6]
1413
Map,
1514
Layers,
1615
Sources,
17-
Animations,
16+
Animations,// [!code focus]
1817
} from "vue3-openlayers";
1918

2019
const app = createApp(App);

docs/componentsguide/geometries.plugin.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ import { createApp } from "vue";
1010
import App from "./App.vue";
1111

1212
import {
13-
// [!code focus:6]
1413
Map,
1514
Layers,
1615
Sources,
17-
Geometries,
16+
Geometries,// [!code focus]
1817
} from "vue3-openlayers";
1918

2019
const app = createApp(App);

docs/componentsguide/interactions.plugin.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ import { createApp } from "vue";
1010
import App from "./App.vue";
1111

1212
import {
13-
// [!code focus:6]
1413
Map,
1514
Layers,
1615
Sources,
17-
Interactions,
16+
Interactions,// [!code focus]
1817
} from "vue3-openlayers";
1918

2019
const app = createApp(App);
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# ol-interaction-mouse-wheel-zoom
2+
3+
> Define the mouse wheel zoom behaviour
4+
5+
[[toc]]
6+
7+
## Demo
8+
9+
<script setup>
10+
import MouseWheelZoomDemo from "@demos/MouseWheelZoomDemo.vue"
11+
</script>
12+
13+
<ClientOnly>
14+
<MouseWheelZoomDemo/>
15+
</ClientOnly>
16+
17+
## Setup
18+
19+
<!--@include: ../../interactions.plugin.md-->
20+
21+
## Usage
22+
23+
| Plugin Usage | Explicit Import |
24+
|-------------------------------------|:--------------------------------------------:|
25+
| `<ol-interaction-mouse-wheel-zoom>` | `<Interactions.OlInteractionMouseWheelZoom>` |
26+
27+
::: code-group
28+
29+
<<< ../../../../src/demos/MouseWheelZoomDemo.vue
30+
31+
:::
32+
33+
## Properties
34+
35+
### Props from OpenLayers
36+
37+
Properties are passed-trough from OpenLayers directly.
38+
Their types and default values can be checked-out [in the official OpenLayers docs](https://openlayers.org/en/latest/apidoc/module-ol_interaction_MouseWheelZoom.html).
39+
Only some properties deviate caused by reserved keywords from Vue / HTML.
40+
This deviating props are described in the section below.
41+
42+
### Deviating Properties
43+
44+
None.
45+
46+
## Events
47+
48+
You have access to all Events from the underlying interaction.
49+
Check out [the official OpenLayers docs](https://openlayers.org/en/latest/apidoc/module-ol_interaction_MouseWheelZoom.html) to see the available events tht will be fired.
50+
51+
```html
52+
<ol-interaction-mouse-wheel-zoom @error="handleEvent" />
53+
```
54+
55+
## Methods
56+
57+
You have access to all Methods from the underlying interaction.
58+
Check out [the official OpenLayers docs](https://openlayers.org/en/latest/apidoc/module-ol_interaction_MouseWheelZoom.html) to see the available methods.
59+
60+
To access the source, you can use a `ref()` as shown below:
61+
62+
```vue
63+
<template>
64+
<!-- ... -->
65+
<ol-interaction-mouse-wheel-zoom ref="interactionRef" />
66+
<!-- ... -->
67+
</template>
68+
69+
<script setup lang="ts">
70+
import { ref, onMounted } from "vue";
71+
import type MouseWheelZoom from "ol/interaction/MouseWheelZoom";
72+
73+
const interactionRef = ref<{ mouseWheelZoom: MouseWheelZoom } | null>(null);
74+
75+
onMounted(() => {
76+
const mouseWheelZoom: MouseWheelZoom = interactionRef.value?.mouseWheelZoom;
77+
// call your method on `mouseWheelZoom`
78+
});
79+
</script>
80+
```
81+
82+

docs/componentsguide/layers.plugin.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ import { createApp } from "vue";
1010
import App from "./App.vue";
1111

1212
import {
13-
// [!code focus:6]
1413
Map,
15-
Layers,
14+
Layers,// [!code focus]
1615
Sources,
1716
} from "vue3-openlayers";
1817

docs/componentsguide/map.plugin.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ import { createApp } from "vue";
1010
import App from "./App.vue";
1111

1212
import {
13-
// [!code focus:5]
14-
Map,
13+
Map,// [!code focus]
1514
Layers,
1615
Sources,
1716
} from "vue3-openlayers";

docs/componentsguide/mapcontrols.plugin.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ import { createApp } from "vue";
1010
import App from "./App.vue";
1111

1212
import {
13-
// [!code focus:6]
1413
Map,
1514
Layers,
1615
Sources,
17-
MapControls,
16+
MapControls,// [!code focus]
1817
} from "vue3-openlayers";
1918

2019
const app = createApp(App);

docs/componentsguide/sources.plugin.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ import { createApp } from "vue";
1010
import App from "./App.vue";
1111

1212
import {
13-
// [!code focus:6]
1413
Map,
1514
Layers,
16-
Sources,
15+
Sources,// [!code focus]
1716
} from "vue3-openlayers";
1817

1918
const app = createApp(App);

docs/componentsguide/styles.plugin.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ import { createApp } from "vue";
1010
import App from "./App.vue";
1111

1212
import {
13-
// [!code focus:6]
1413
Map,
1514
Layers,
1615
Sources,
17-
Styles,
16+
Styles,// [!code focus]
1817
} from "vue3-openlayers";
1918

2019
const app = createApp(App);

0 commit comments

Comments
 (0)