简体   繁体   English

OpenLayers:什么时候单击平底锅?

[英]OpenLayers: When is a click a pan?

Is there a way in OpenLayers (v3.0.1) to set the threshold / tolerance of how many pixels of "dragging" it takes to start panning? OpenLayers(v3.0.1)中是否有一种方法可以设置开始平移需要多少“拖动”像素的阈值/容限?

Some of our users use the map with a touchscreen device and a stylus (pen) to select features and pan the map. 我们的某些用户将地图与触摸屏设备和触控笔(笔)一起使用以选择要素并平移地图。 Now with the stylus, when they "click" they seem to drag a few pixels and the map reacts with panning instead of a select/click event. 现在使用手写笔,当他们“单击”时,它们似乎拖动了几个像素,并且地图以平移而不是select / click事件进行反应。

Edit: I'm using the select-interaction for the "clicking"/"selecting". 编辑:我正在使用选择交互的“单击” /“选择”。

In OpenLayers v4.2.0 a new option was introduced: 在OpenLayers v4.2.0中引入了一个新选项:

moveTolerance : The minimum distance in pixels the cursor must move to be detected as a map move event instead of a click. moveTolerance :必须将光标移动到的最小距离(以像素为单位),以将其检测为地图移动事件(而非单击)。 Increasing this value can make it easier to click on the map. 增大此值可以使单击地图更容易。

The changelog said: 更改日志说:

Some touch devices do not play well with OpenLayers's way of detecting clicks. 某些触摸设备无法与OpenLayers的检测点击方式配合使用。 To overcome this, a new moveTolerance option was introduced, so users can override the 1 pixel threshold above which a touch-release sequence won't be considered a click any more. 为了克服这个问题,引入了一个新的moveTolerance选项,因此用户可以覆盖1像素阈值,在此阈值之上,触摸释放序列将不再被视为单击。

https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM