【问题标题】:Tie a marker to the center of a circle将标记系在圆圈的中心
【发布时间】:2013-10-17 07:25:56
【问题描述】:

我的地图上有一个可编辑的圆圈,我想看看是否可以让标记始终出现在圆圈的中心。我知道我可以有一个标记并在移动时将其移动到圆的中心。问题是圆圈没有“被拖动时”事件,所以我应该等待拖动停止,然后将标记移动到新的中心。

【问题讨论】:

  • 你能在 circle 对象上为center_changed 事件设置一个事件监听器吗?
  • 你想在bind圆心的位置做一个标记?
  • @duncan:是的,但正如我所说,我希望标记在圆圈移动时移动,而不仅仅是在移动完成时。
  • @geocodezip 是的,我查看了你给我的链接,但我不明白如何将它应用到我的案例 bindTo(key:string, target:MVCObject, targetKey?:string, noNotify?:boolean )
  • 如果我将this example 中的圆圈设为可拖动,它对我有用。来自this "article" in the documentation

标签: google-maps-api-3 google-maps-markers


【解决方案1】:

Bind圆心到一个标记的位置

this "article" in the documentation

Proof of concept

该示例中的相关更改代码:

    var circle = new google.maps.Circle({
      strokeWeight: 2,
      draggable: true
    });

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-21
    • 1970-01-01
    • 2017-01-03
    • 1970-01-01
    相关资源
    最近更新 更多