Ela
unread,Sep 13, 2010, 5:58:37 AM9/13/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Maps JavaScript API v3
Hi,
I need to add a custom control to the BOTTOM_RIGHT corner of the map.
map.controls[google.maps.ControlPosition.BOTTOM_RIGHT].push(controlDiv);
But this is not working in Google maps V3 because it will be displayed
to the left of the terms of use text every time, regardless if I set
the index of the control or not.
controlDiv.index = 0;
map.controls[google.maps.ControlPosition.BOTTOM_RIGHT].push(controlDiv);
I couldn't find a solution in this forum but it is not the first time
this question has been asked, so maybe someone has a solution for
this, would be very nice!
By the way, is there a nice and safe way to remove a custom control?
At the moment I iterate the controls[..] collection and check if the
control is the same object or has the same id and then try to remove
the control at the current position/index
map.controls[google.maps.ControlPosition.BOTTOM_RIGHT].forEach(function(element,
index) {
if (element == controlDiv) {
map.controls[google.maps.ControlPosition.BOTTOM_RIGHT].removeAt(index);
}
});
Is this correct? I personally don't like such code in JavaScript... it
is not fail safe at all
Thanks.