syaf-rizal / 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

Cluster icon y-pos incorrect #318

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
1. Create a cluster with a few markers
2. Grab the center of the cluster using cluster.getCenter()
3. Create a regular, non-cluster marker with the position set to that cluster 
center

Expected result:
The cluster and the marker should have the same, or very close (rounding errors 
due to int parsing) to the same, position

Actual result:
The cluster is positioned lower than the marker by what appears to be half the 
height of the cluster style.

ClusterIcon.prototype.getPosFromLatLng_ = function (latlng) {
  var pos = this.getProjection().fromLatLngToDivPixel(latlng);
  pos.x -= this.anchorIcon_[1];
  pos.y -= this.anchorIcon_[0]; <---- Adding *2 resolves the problem. anchorIcon_[0] is not being properly calculated
  pos.x = parseInt(pos.x, 10);
  pos.y = parseInt(pos.y, 10);
  return pos;
};

Original issue reported on code.google.com by Hawbaker...@gmail.com on 22 Aug 2014 at 6:08

GoogleCodeExporter commented 9 years ago
Nevermind :[ wasn't properly setting AnchorIcon

Original comment by Hawbaker...@gmail.com on 26 Aug 2014 at 5:06