From 0c381325bb87732fc0a88fd4f1c6ecd154ab3913 Mon Sep 17 00:00:00 2001 From: Josh Caldwell Date: Fri, 5 Jul 2013 11:50:36 -0400 Subject: [PATCH] Fix issue with mouse position when page is scrolled --- src/dom/DomEvent.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dom/DomEvent.js b/src/dom/DomEvent.js index 2966f115..6eaa2bf6 100644 --- a/src/dom/DomEvent.js +++ b/src/dom/DomEvent.js @@ -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,