OpenLayers 2“OpenLayers.Control.DragFeature”功能的等效项是什么。我需要向地图添加一个可以用鼠标移动的图标。当掉落时我需要捕捉事件。
在 OpenLayers 2 中,描述的功能是:
new OpenLayers.Control.DragFeature(this.MarkersLayer, {
onComplete: function(feature, pixel) { /* here comes the action after dropping the marker */ }}
有谁知道如何使用 OpenLayers 3 来实现这一点?
OpenLayers 3 现在包含一个示例,展示如何实现“拖动功能”交互。看http://openlayers.org/en/master/examples/drag-features.html http://openlayers.org/en/master/examples/drag-features.html.
因此,OpenLayers 3 库仍然不提供“拖动功能”交互,但它提供了扩展点,使得在应用程序级别实现此类交互成为可能。
请注意,您必须使用 OpenLayers 3 的“master”分支来实现您自己的“拖动功能”交互,如示例中所示。另一种选择是等待 3.1.0,它应该很快就会发布。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)