【发布时间】:2020-03-08 20:13:21
【问题描述】:
我希望用户能够用鼠标/手指平移地图。但是,我想将缩放限制为仅使用 HERE ui 控件。
我尝试了以下方法:
// Since our marker is in the center of the map we need to make sure zooming occurs at center of map only
// The user can zoom to their mouse position which may not be center, so we need to disable and allow zooming
// via the +/- buttons only :(
this.mapBehavior.disable(window.H.mapevents.Behavior.WHEELZOOM)
this.mapBehavior.disable(window.H.mapevents.Behavior.PINCH_ZOOM)
this.mapBehavior.disable(window.H.mapevents.Behavior.DBL_TAP_ZOOM)
this.mapBehavior.enable(window.H.mapevents.Behavior.PANNING) <-- this renables zoom
很遗憾,如果我禁用 WHEELZOOM,我也会失去平移功能。 如果我重新启用 PANNING,则会重新打开缩放功能。
如何在不禁用平移的情况下禁用缩放?
【问题讨论】:
标签: javascript here-api