简体   繁体   English

在地图上移动时如何更改Google地图的标记大小

[英]How to change google map's marker size when moving it on map

How to change google map's marker when moving it on the map. 在地图上移动时如何更改Google地图的标记。

When I move on the map, change marker's size to small and when it's in a fixed position change its size to large. 当我在地图上移动时,将标记的大小更改为小,而在固定位置时,将其大小更改为大。

Thanks. 谢谢。

You could try to do it when the events 'dragstart' and 'dragend' are triggered. 当触发事件“ dragstart”和“ dragend”时,您可以尝试执行此操作。

Example: 例:

  google.maps.event.addListener(marker, 'dragstart', function(event) {
    //increase size
    marker.setIcon({url : 'path_to_img', scaledSize: {height: 12 , width: 12}})
  });

  google.maps.event.addListener(marker, 'dragend', function(event) {
   //decrease size
   marker.setIcon({url : 'path_to_img', scaledSize: {height: 64 , width: 64}})
  });

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

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