On Sep 6, 3:35 pm, Esa <
esa.ilm...@gmail.com> wrote:
See issue 1651:
http://code.google.com/p/gmaps-api-issues/issues/detail?id=1651
Internet Explorer behaves differently than the other browsers (what a
surprise).
PolyCluster.prototype.click=function(e)
{
var x=window.event ? window.event.x : e.layerX;
var y=window.event ? window.event.y : e.layerY;
e=window.event ? window.event.srcElement : e.currentTarget;
for (;(!e._)*(!!e.parentNode);) e=e.parentNode;
if (e._) e._.clickCallBack({x:x+e._.X-(e._.X_>>1),y:y+e._.Y-
(e._.Y_>>1)},e._.Z);
}
Because the "this" property refers to the "in-play" element rather
than to the OverlayView object, I have to retain a back reference to
the "this" property of the OverlayView object. It contains the DIV
pixel offsets. I have to loop back through parent nodes in order to
find it.
e._ is "this" for the OverlayView object.
e._.X is the center X position.
e._.Y is the center Y position.
e._.X_ is the width of the DIV.
e._.Y_ is the height of the DIV.
x is the X pixel offset of the click.
y is the Y pixel offset of the click.
Firefox calculates "x" & "y" relative to the DIV containing the tile.
Internet Explorer calculates "x" & "y" relative to the parent DIV. In
order to make Firefox calculate pixel offsets correctly, I have to
expose an otherwise hidden but empty DIV covering the tiles.
l=this.get_map().getDiv().childNodes[0].childNodes[1];
l.style.display="";
l.style.left=0+"px";
l.style.top=0+"px";
l.style.width="100%";
l.style.height="100%";
l.style.zIndex=1;
l.parentNode.onclick=this.click;
l.parentNode.onmousemove=this.cover;
l.parentNode.onmouseover=this.cover;
l.parentNode.onmouseout=this.clear;
l.parentNode._=this;
I have to place the event handlers on the parent node. Otherwise,
Internet Explorer will never see it.
Clearly, it makes sense for Google to do it to avoid the browser
dependencies & conflict with its own event listeners.