Hey guys!
In gmaps2 I was using the following code to draw a circle around the
marker the user mouse is currently on:
//currentMarker is a marker object
var markerPoint = currentMarker.getPoint();
var polyPoints = Array();
if (highlightCircle) {
map.removeOverlay(highlightCircle);
}
var mapNormalProj = G_NORMAL_MAP.getProjection();
var mapZoom = map.getZoom();
var clickedPixel = mapNormalProj.fromLatLngToPixel(markerPoint,
mapZoom);
var polySmallRadius = 20;
var polyNumSides = 20;
var polySideLength = 18;
for (var a = 0; a<(polyNumSides+1); a++) {
var aRad = polySideLength*a*(Math.PI/180);
var polyRadius = polySmallRadius;
var pixelX = clickedPixel.x + 5 + polyRadius *
Math.cos(aRad);
var pixelY = clickedPixel.y - 10 + polyRadius *
Math.sin(aRad);
var polyPixel = new GPoint(pixelX,pixelY);
var polyPoint =
mapNormalProj.fromPixelToLatLng(polyPixel,mapZoom);
polyPoints.push(polyPoint);
}
// Using GPolygon(points, strokeColor?, strokeWeight?,
strokeOpacity?, fillColor?, fillOpacity?)
highlightCircle = new
GPolygon(polyPoints,"#000000",2,0.0,"#FF0000",.
5);
map.addOverlay(highlightCircle);
In google maps api3 I saw that there is a circle object and it is
really easy to use, but it doesn't have the effect I'm looking for.
The circle size should not change when the user zooms in.
I tried to transform the above example to api3, but I couldn't find
fromLatLngToPixel and fromPixelToLatLng functions.
What would be the best way to draw a circle and bind it to the
currently active marker? Thank you in advance!
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.