Merge pull request #1 from jec006/fix_mouse_position_relative

Fix issue with mouse position when page is scrolled
This commit is contained in:
Scooter Wadsworth 2013-07-05 09:48:26 -07:00
commit 4e2a7f2030

View File

@ -135,8 +135,8 @@ L.DomEvent = {
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,
x = e.pageX ? e.pageX - body.scrollLeft - docEl.scrollLeft: e.clientX,
y = e.pageY ? e.pageY - body.scrollTop - docEl.scrollTop: e.clientY,
pos = new L.Point(x, y),
rect = container.getBoundingClientRect(),
left = rect.left - container.clientLeft,