Friday, May 21, 2010

Draw a line during mouseover

I am trying to draw a line for a circle (between first point and the
second one). After setting the first point , should start to draw the
line on the cursor. If you set the second point should the line end
and the circle is drawed. So the line should be a help for the user.
I have already the function to draw a circle by setting two points.
The function for the line isn't working proberly.
Have any one a idea???
...
var color = "0DFF00";
var line = new GPolyline([], color, 3, 9);
line.enableDrawing();
line.enableEditing({onEvent: "mouseover"});
line.disableEditing({onEvent: "mouseout"});
map.addOverlay(line);

GEvent.addListener(map,'click',
function(overlay, point) {
if (point) {
if (count == 0){
point1 = new GLatLng(point.y, point.x);
var marker = new GMarker(point1);
map.addOverlay(marker);
line.insertVertex(count, point1);
}
if (count == 1){
point2 = new GLatLng(point.y, point.x);
//var marker = new GMarker(point2, {draggable: true});
var marker = new GMarker(point2);
map.addOverlay(marker);
var circle = drawCircle(point1,
point2,"#0055ff","#997F99");
map.addOverlay(circle);
line.insertVertex(count, point2);

}
if(count == 1){
count = 0;
}
else{
count ++;
}
}
}
);

--
You received this message because you are subscribed to the Google Groups "Google Maps API" group.
To post to this group, send email to google-maps-api@googlegroups.com.
To unsubscribe from this group, send email to google-maps-api+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate