我目前有一个 Openlayers 3 集成,其中包含许多更新功能,这些功能会导致滚动卡顿,尤其是在使用“动态”运动(轻弹滚动)时。有没有办法关闭惯性的平滑滚动,以便用户必须拖动才能移动地图?
删除缩放动画也会有所帮助。
我一直在 ol.animation 区域寻找这些 - 这是正确的地方吗?
可以在ol.interaction.DragPan交互中关闭动力学。可以通过传递duration: 0给ol.interaction.MouseWheelZoom.
在此处查看现场示例:http : //jsfiddle.net/9v6fd6as/1/
这是示例源代码:
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
interactions: ol.interaction.defaults({
dragPan: false,
mouseWheelZoom: false
}).extend([
new ol.interaction.DragPan({kinetic: false}),
new ol.interaction.MouseWheelZoom({duration: 0})
]),
target: 'map',
view: new ol.View({
center: [0, 0],
zoom: 2
})
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2912 次 |
| 最近记录: |