OL def interactions
HTML
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
<script src="https://unpkg.com/[email protected]/dist/ol.js"></script>
<script src="https://unpkg.com/[email protected]/lib/index.umd.js"></script>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/lib/style.min.css">
<script src="https://rawgit.com/icebob/fakerator/master/dist/fakerator.js"></script>
<div id="app">
<vl-map ref="map" @created="mapCreated">
<vl-view :zoom.sync="zoom" :center.sync="center"></vl-view>
<vl-layer-tile>
<vl-source-osm></vl-source-osm>
</vl-layer-tile>
</vl-map>
</div>
CSS
html, body, #app {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
JavaScript
Vue.use(VueLayers)
new Vue({
el: '#app',
data () {
return {
zoom: 3,
center: [0, 0],
}
},
methods: {
/**
* mapCmp - vl-map component
*/
mapCreated (mapCmp) {
// $map - reference to the ol.Map instance
let interactions = mapCmp.$map.getInteractions()
interactions.clear()
interactions.extend(ol.interaction.defaults({
ouseWheelZoom: false,
}).getArray())
},
},
})