Scrolling Offset Bug Fix
This commit is contained in:
parent
f58a1c7369
commit
d4c73d2b57
@ -117,7 +117,7 @@ L.DomEvent = {
|
||||
y = e.pageY ? e.pageY : e.clientY +
|
||||
document.body.scrollTop + document.documentElement.scrollTop,
|
||||
pos = new L.Point(x, y);
|
||||
|
||||
pos=pos.add(L.DomUtil.getCumulativeScroll(container))
|
||||
return (container ?
|
||||
pos.subtract(L.DomUtil.getCumulativeOffset(container)) : pos);
|
||||
},
|
||||
|
@ -28,7 +28,16 @@ L.DomUtil = {
|
||||
el = el.offsetParent;
|
||||
} while (el);
|
||||
return new L.Point(left, top);
|
||||
},
|
||||
},getCumulativeScroll: function(el){
|
||||
var top=0,
|
||||
left=0;
|
||||
do {
|
||||
top+=el.scrollTop || 0;
|
||||
left+=el.scrollLeft || 0;
|
||||
el=el.parentNode;
|
||||
}while(el);
|
||||
return new L.Point(left,top)
|
||||
},
|
||||
|
||||
create: function(tagName, className, container) {
|
||||
var el = document.createElement(tagName);
|
||||
|
Loading…
Reference in New Issue
Block a user