ZachPhillipsGary / google-maps-utility-library-v3

Automatically exported from code.google.com/p/google-maps-utility-library-v3
Apache License 2.0
0 stars 0 forks source link

*MarkerClustererPlus: additional marker on map shows below ClusterImage OverlayView #148

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. use MarkerClustererPlus v2.0.6
2. use Google Maps Javascript v3.7
3. set up a Map
4. create a MarkerClusterer with a set of Markers that should cluster (close 
proximity)
5. with the ClusterImage visible, add your own Marker, 
  5.1. as a kind of Drop-Pin (Animate.DROP)
    -- animation nonessential
  5.2. with zIndex google.maps.Marker.MAX_ZINDEX

Expected result:
Drop-Pin marker should display on top of ClusterImage OverlayView, not under 
it, especially when:
* Drop-Pin marker added after MarkerClusterer completed displaying clusters
* Drop-Pin marker setZIndex(google.maps.Marker.MAX_ZINDEX)

Actual result:
Drop-Pin marker displays under ClusterImage OverlayView without regard to 
zIndex.  

Version: MarkerClustererPlus 2.0.6

Browser / Operating System:
Chrome 15.0.874.121 (OS X 10.6)
Safari 5.1.2 (OS X 10.6)
Firefox 8.0.1 (OS X 10.6)
-- really not browser specific

Additional comments:

There is a fix for this: appendChild to overlayImage pane.  Still receives 
mouse events.

markerclusterer.js:127
-  this.getPanes().overlayMouseTarget.appendChild(this.div_);
+  this.getPanes().overlayImage.appendChild(this.div_);

*********************************************************
Tip: Star this issue (next to title) to receive notifications of status
changes against this issue, also used as a gauge for how many people are
interested in seeing it resolved.
*********************************************************

Original issue reported on code.google.com by ptan...@raditaz.com on 10 Dec 2011 at 2:17

GoogleCodeExporter commented 9 years ago
This issue has been raised before and the thought has been to ensure that the 
clustered markers appear above everything else. Let me reconsider by switching 
to overlayPane on a production map to see if anything breaks.

Original comment by garylitt...@gmail.com on 13 Dec 2011 at 4:31

GoogleCodeExporter commented 9 years ago
By the way: if switching to overlayImage pane there is much work to be done in 
addition to the single line change you mentioned.

Original comment by garylitt...@gmail.com on 13 Dec 2011 at 4:36

GoogleCodeExporter commented 9 years ago
Would it be possible instead to set a high zIndex?  From my reading of the 
Google Maps v3 docs, that is the recommended way.  I have changed my code with 
the above fix and you may verify on http://www.raditaz.com or (development) 
http://quesofresco.raditaz.com - create user -> Edit Station -> Edit Location.

If you want I will gladly test and submit code.  

The fix noted above does not break for what I am doing but will test other 
overlays.

Original comment by ptan...@raditaz.com on 13 Dec 2011 at 4:41

GoogleCodeExporter commented 9 years ago
I am definitely missing something, then.  I'll review other code tests you use. 
 So far it works for my (admittedly limited) use case.

Original comment by ptan...@raditaz.com on 13 Dec 2011 at 4:44

GoogleCodeExporter commented 9 years ago
I don't think the click handler works when the pane is changed to overlayImage. 
Not sure why, but I haven't really studied the issue yet. The cluster icons 
need to be standard markers if in overlayImage pane, so that will affect a lot 
of code as well. I'm beginning to see why the original creator of 
MarkerClusterer did it the way he did.

Original comment by garylitt...@gmail.com on 13 Dec 2011 at 4:47

GoogleCodeExporter commented 9 years ago
This code works for a click event handler:

function createClusterer(markers) {
    var cluster_styles = [{
      // [yoffset, xoffset] from top left: cluster location bottom center
      //anchorIcon: [40, 20],
      // we actually want the real center (simplifies things later)
      width: 40,
      height: 40,
      url: /images/stations/map_pin_multiple.png
    }],
    opts = {
      averageCenter: true,
      gridSize: 40,
      zoomOnClick: false,
      imagePath: images/stations,
      imageExtension: png,
      imageSizes: [40],
      styles: cluster_styles,
      calculator: self.cluster_calculate,
      zoomOnClick: false,
      title: Cluster of Stations
    },
    clusterer = new MarkerClusterer(self.map, markers, opts);
    google.maps.event.addListener(clusterer, 'click', self.onClusterClicked);
    return clusterer;
}

What I used was google.maps.addListener() not google.maps.addDomListener (used 
in ClusterIcon.prototype.onAdd,
http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclustererpl
us/src/markerclusterer.js:128).

Original comment by ptan...@raditaz.com on 13 Dec 2011 at 5:20