简体   繁体   English

Google Maps标记

[英]Google Maps marker

How to change the color of a google.maps.SymbolPath.CIRCLE marker on mouseover event? 如何在鼠标悬停事件上更改google.maps.SymbolPath.CIRCLE标记的颜色? I read about the setIcon method but i don't want to add a new image only to change the circle's color. 我阅读了有关setIcon方法的信息,但我不想仅添加新图像来更改圆圈的颜色。

There is no method to change a particular property of an existing symbol. 没有方法可以更改现有符号的特定属性。

You must retrieve the current symbol( marker.getIcon() ) set the new property(for a circle this would be strokeColor ), and use the modified symbol as argument for marker.setIcon() 您必须检索当前的符号( marker.getIcon() )设置新属性(对于一个圆,它将是strokeColor ),并使用修改后的符号作为marker.setIcon()参数。

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

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