Fixed localx/localy calculation

This commit is contained in:
Barry Silverman 2010-09-18 14:04:52 -04:00
parent 1fd86334f7
commit 6276d019d7

View File

@ -306,19 +306,13 @@ function setChipStyle(props){
function localx(el, gx){ function localx(el, gx){
var lx = gx+window.pageXOffset; var lx = gx+window.pageXOffset;
while(el.offsetLeft!=undefined){ lx-=el.getBoundingClientRect().left
lx-=el.offsetLeft+el.clientLeft;
el = el.parentNode;
}
return lx; return lx;
} }
function localy(el, gy){ function localy(el, gy){
var ly = gy+window.pageYOffset; var ly = gy+window.pageYOffset;
while(el.offsetTop!=undefined){ ly-=el.getBoundingClientRect().top
ly-=el.offsetTop+el.clientTop;
el = el.parentNode;
}
return ly; return ly;
} }