Openlayers 3中的拖放功能 [英] Drag and Drop Feature in Openlayers 3

查看:120
本文介绍了Openlayers 3中的拖放功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是OpenLayers 2"OpenLayers.Control.DragFeature"功能的等效项.我需要在地图上添加一个图标,该图标可以用鼠标移动.放下时,我需要赶上事件. 在OpenLayers 2中,所描述的功能是:

What is the equivalent for the OpenLayers 2 "OpenLayers.Control.DragFeature" functionality. I need to add an Icon to a map, that is moveable with the mouse. When dropping I need to catch the event. In OpenLayers 2, the described functionality is:

new OpenLayers.Control.DragFeature(this.MarkersLayer, {     
    onComplete: function(feature, pixel) { /* here comes the action after dropping the marker */ }}

有没有人知道如何使用OpenLayers 3做到这一点?

Does anyone has an idea how this can be accomplished with OpenLayers 3?

推荐答案

OpenLayers 3现在包括一个示例,该示例显示了如何实现拖动功能"交互.请参见 http://openlayers.org/en/master/examples/drag-features. html .

OpenLayers 3 now includes an example that show how to implement a "drag feature" interaction. See http://openlayers.org/en/master/examples/drag-features.html.

因此,OpenLayers 3库仍然不提供拖动功能"交互,但是它提供了扩展点,使在应用程序级别实现这种交互成为可能.

So, the OpenLayers 3 library still doesn't provide a "drag feature" interaction, but it provides the extension points making it possible to implement such an interaction at the application level.

请注意,如示例所示,您将必须使用OpenLayers 3的"master"分支来实现自己的拖动功能"交互.另一个选择是等待3.1.0,这应该很快就会推出.

Note that you will have to use the "master" branch of OpenLayers 3 to implement your own "drag feature" interaction as in the example. The other option is to wait for 3.1.0, which should be out pretty soon.

这篇关于Openlayers 3中的拖放功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆