如何将标记拖出地图 [英] How can I drag a marker out of the map

查看:56
本文介绍了如何将标记拖出地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够将标记从地图区域拖到页面上的其他(启用拖放)元素上(例如,将其包括在列表中). 我该如何使用传单? 如果我尝试将标记拖出地图,它会消失在地图周围区域的下方...

I would like to be able to drag a marker out of the map area onto some other (drop-enabled) element on the page (to include it in a list for example). How can I do this with leaflet? If I try to drag a marker out of the map, it just disappears underneath the area surrounding the map...

推荐答案

您将无法通过传单功能执行此操作.一种方法可能是:

You won't be able to do this with leaflet functionality. One approach could be:

  1. 听有关标记的事件.您实际上不希望在更改位置时拖动标记,因此您可能想要在标记内更改该设置并使用mouse down事件或其他方法.
  2. 创建元素以将其拖放到地图之外,但将其z-index和其他css属性设置为,使其看起来像是标记.
  3. 使用html5/jquery/etc中的拖放内容将其放置在容器中.

仅供参考:此处与拥有可拖动的对象移动到地图上,然后作为标记插入.

FYI: Here is the opposite approach of having a draggable object moved on to the map and then inserted as a marker.

这篇关于如何将标记拖出地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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