Skip to content

Commit

Permalink
attempt to address regressions from Leaflet#1684, Leaflet#1745
Browse files Browse the repository at this point in the history
  • Loading branch information
geographist committed Jul 4, 2013
1 parent 642fc81 commit 914807c
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/dom/DomEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,30 @@ L.DomEvent = {

getMousePosition: function (e, container) {

var body = document.body,
var ie7 = L.Browser.ie7,
body = document.body,
docEl = document.documentElement,
x = e.pageX ? e.pageX : e.clientX + body.scrollLeft + docEl.scrollLeft,
y = e.pageY ? e.pageY : e.clientY + body.scrollTop + docEl.scrollTop,
pos = new L.Point(x, y);
pos = new L.Point(x, y),
rect = container.getBoundingClientRect(),
left = rect.left - container.clientLeft,
top = rect.top - container.clientTop;

// webkit (and ie <= 7) handles RTL scrollLeft different to everyone else
// https://code.google.com/p/closure-library/source/browse/trunk/closure/goog/style/bidi.js
if (!L.DomUtil.documentIsLtr() && (L.Browser.webkit || ie7)) {
left += container.scrollWidth - container.clientWidth;

// ie7 shows the scrollbar by default and provides clientWidth counting it, so we
// need to add it back in if it is visible; scrollbar is on the left as we are RTL
if (ie7 && L.DomUtil.getStyle(container, 'overflow-y') !== 'hidden' &&
L.DomUtil.getStyle(container, 'overflow') !== 'hidden') {
left += 17;
}
}

return (container ? pos._subtract(L.DomUtil.getViewportOffset(container)) : pos);
return pos._subtract(new L.Point(left, top));
},

getWheelDelta: function (e) {
Expand Down

0 comments on commit 914807c

Please sign in to comment.