[Pkg-javascript-commits] [leaflet] 28/301: Make container optional in L.DomUtil.getMousePosition(). Addresses #1926

Jonas Smedegaard js at moszumanska.debian.org
Mon Jan 27 22:22:39 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository leaflet.

commit ea044c8312cf717cda4fdd820884674505dd754f
Author: Scooter Wadsworth <scooterwadsworth at gmail.com>
Date:   Thu Aug 1 00:15:53 2013 -0400

    Make container optional in L.DomUtil.getMousePosition(). Addresses #1926
---
 src/dom/DomEvent.js | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/dom/DomEvent.js b/src/dom/DomEvent.js
index 7df9e7f..a9a9f9a 100644
--- a/src/dom/DomEvent.js
+++ b/src/dom/DomEvent.js
@@ -137,8 +137,13 @@ L.DomEvent = {
 		    docEl = document.documentElement,
 		    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(),
+		    pos = new L.Point(x, y);
+
+		if (!container) {
+			return pos;
+		}
+
+		var rect = container.getBoundingClientRect(),
 		    left = rect.left - container.clientLeft,
 		    top = rect.top - container.clientTop;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/leaflet.git



More information about the Pkg-javascript-commits mailing list