My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 1976: Bug: Custom icon & draggable marker issues
2 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Jan 2010


Sign in to add a comment
 
Reported by [email protected], Nov 30, 2009
When a custom marker is created using an image that is not the same size as 
the standard marker (20x34) there are issues with overlapping. If the 
following code is run:
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<script type="text/javascript" src="http://maps.google.com/maps/api/js?
sensor=false"></script>
<script type="text/javascript">
function initialize() {
    var width = 10, height = 17;
    //var width = 20, height = 34;
    var latlng = new google.maps.LatLng(37.313477473067, -
121.880502070713);
    var newlatlng = new google.maps.LatLng(37.317477473067, -
121.880502070713);
    var myOptions = {
      zoom: 11,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map_canvas"), 
myOptions);
    var draggablemarker = new google.maps.Marker({map:map, position:latlng, 
draggable:true, flat:true});
    var testmarker = new google.maps.Marker({map:map, position:newlatlng, 
icon:"http://chart.apis.google.com/chart?cht=mm&chs=" + width + "x" + 
height + "&chco=B22222,B22222,000000&ext=.png"});
}
</script>
</head>
<body onload="initialize()" style="margin:0px;">
 <div id="map_canvas" style="width:100%; height:100%">
</body>
</html>

Then you can see the custom icon is overlapping the default marker. When 
you set the custom icon width and size to be the same as the default then 
everything works fine. If I could venture a guess it seems as if there's 
some div used to determine overlapping that remains the default size and 
doesn't change to the size of the new icon image.

There's another issue I'll say here as the very same code above illustrates 
it. When you drag the draggable marker over another marker and release the 
left mouse button the "mouseout" event for the draggable marker doesn't 
seem to fire and the draggable marker will still follow your mouse around 
until you click elsewhere on the map.
Jan 6, 2010
#1 [email protected]
Overlapping can be fixed by setting the zIndex properties for each marker
accordingly.  If you want to the dragging marker displayed above the custom marker,
set a higher zIndex for the former.

I confirmed the second issue when dragging a marker over another marker.  Would you
like to file this issue?  If so, I'll update the title and report it internally.
Status: NeedsMoreInfo
Jan 6, 2010
#2 [email protected]
What I mean to say is that custom markers further north of the default marker will 
overlap when this shouldn't be the case. It's very similar to an issue I filed earlier 
in which this was always happening. It was fixed but not completely. Custom icons 
smaller than the default icon will still improperly overlap the default marker when 
they're further north of the default, but only to a certain point.
Jan 7, 2010
#3 [email protected]
I see the problem.  Thanks for clarifying the issue.

I've reported both issues to the team.
Status: Confirmed
Labels: Internal-2362256 Internal-2362257
Jan 19, 2010
#4 [email protected]
Fixed z-index issue.

Issue with dragging a marker over a custom marker is still pending.
Status: Fixed
Labels: Fixed-25
Apr 5, 2010
Project Member #5 [email protected]
(No comment was entered for this change.)
Labels: Fixed-35
Sign in to add a comment

Powered by Google Project Hosting