| Issue 2860: | pixelBounds object needs official documentation | |
| 7 people starred this issue and may be notified of changes. | Back to list |
The official documentation speaks of the pixelBounds object within the documentation of the infoWindow - "However, an anchor can be any MVCObject that exposes the position property and optionally pixelBounds for calculating the pixelOffset (see InfoWindowOptions)." There is, however, no documentation of this object. In addition, it is obvious that it is used within objects such as Markers. Could you please document and fix the property names for this object so that it can be accessed safely ? This is especially useful when developing custom info windows for calculating offsets from marker images.
Nov 21, 2010
For a specific use case, the actual size of a marker on the map is needed when creating a cluster script. As it stands, it's impossible to write a generic agnostic cluster script for v3 "by the docs".
Nov 29, 2010
(No comment was entered for this change.)
Labels:
-ApiType-Javascript ApiType-Javascript3
Dec 6, 2010
(No comment was entered for this change.)
Status:
Acknowledged
Labels: Internal-3211474
Feb 22, 2011
This is now exposed via 'anchorPoint' MVC property on Marker. It is of type Point.
var anchor = marker.get('anchorPoint');
console.log(anchor.x, anchor.y);
Status:
Fixed
Labels: Fixed-3.4 Component-Docs
Feb 23, 2011
How can you put this as fixed ? Your implementation does not correspond to the pixelBounds object AT ALL. The 'anchorPoint' property gives the position of the marker. The 'pixelBounds' object gives the pixel dimensions of the marker in relation to the anchorPoint - this is not the same. Please document pixelBounds - we need it, we use it, you use it !
Feb 23, 2011
'anchorPoint' replaced 'pixelBounds' inside the API. We no longer use the 'pixelBounds' of an overlay to position the info window. 'anchorPoint' is not the position of the marker. 'anchorPoint' is the offset from an overlay's position to the tip of the info window, ie. the point to which the info window is anchored.
Feb 23, 2011
Thank you for your clarification. What you are saying is that, after having accepted this request, you have decided to not implement that which was asked for. As comment #2 stated, we are unable to determine the size of a marker, notably when the icon is given as an image file instead of a MarkerImage object. This is one of the reasons why we need this object to be documented and correctly filled in.
Apr 17, 2013
I'd absolutely vote for a public function to retrieve the Marker size in pixels. Although it's possible to get the shape as poly coords list, it's close to impossible to work out what size the marker has. That's really needed to do mini clustering (for e.g. split up markers if they overlap) or a real cluster script.
Apr 17, 2013
Heh, I'd say that if the (trivial) issue isn't fixed by now, it'll never be fixed. Such a waste for such low hanging fruit. |
|
| ► Sign in to add a comment |
Yes, please add a method marker.pixelBounds.getIconSize() or such to return the height and width. var pb = marker.pixelBounds; var iconX = Math.abs(pb.l) + Math.abs(pb.q); var iconY = Math.abs(pb.n) + Math.abs(pb.o); alert('Width: ' + iconX + ', Height: ' + iconY);