[英]How can I disable mouseWheelZoom in OpenLayers 7?
我刚刚从 OpenLayers 6 更新到版本 7。我现在收到有关交互的错误。 我想禁用缩放,以便可以滚动页面。 只有在使用“platformModifierKeyOnly”时才可以通过滚动进行缩放。 这是曾经工作的代码:
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,
}),
]),
});
但是现在我在控制台中收到以下错误: ol.interaction.defaults is not a function
。
不幸的是,OpenLayers 文档对于找出需要更改的内容以使其再次工作并没有太大帮助。
在 OpenLayers 7 中,语法是ol.interaction.defaults.defaults
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.