我尝试使用鼠标悬停事件将颜色更改为一个 Gpolygon
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(-39.875696,-72.624207), 9);
pLat = 0.2;
pLon = 0.2;
p1Lat = -40;
p1Lon = -73;
p1Coor = [
new GLatLng(p1Lat, p1Lon - pLon),
new GLatLng(p1Lat + pLat, p1Lon),
new GLatLng(p1Lat, p1Lon + pLon),
new GLatLng(p1Lat - pLat, p1Lon),
new GLatLng(p1Lat, p1Lon - pLon)
];
var p1 = new GPolygon(p1Coor, "#f33f00", 2, 1, "#ff0000", 0.2);
GEvent.addListener(p1,"mouseover",function(overlay,latlng){
p1.color = "#ffff00";
alert(p1.color);
});
map.addOverlay(p1);
属性发生了变化,但我没有看到变化。为什么 ?