I have just updated from OpenLayers 6 to version 7. I now get an error regarding the interactions. I want to disable the zoom so the page can be scrolled. Only when using "platformModifierKeyOnly" zooming via scroll should be possible. This is the code that used to work:
const map = new ol.Map({
layers: [clusterHulls, clusters, clusterCircles],
target: 'map',
view: view,
interactions: ol.interaction.defaults({
dragPan: false,
mouseWheelZoom: false
}).extend([
new ol.interaction.DragPan({
condition: function (event) {
return this.getPointerCount() === 2 || ol.events.condition.platformModifierKeyOnly(event);
},
}),
new ol.interaction.MouseWheelZoom({
condition: ol.events.condition.platformModifierKeyOnly,
}),
]),
});
But now I get the following error in the console: ol.interaction.defaults is not a function
.
Unfortunately the OpenLayers documentation doesn't help much to find out what needs to be changed to get this working again.
In OpenLayers 7 the syntax is is ol.interaction.defaults.defaults