[Pkg-javascript-commits] [leaflet] 53/301: some tweaks to #1951

Jonas Smedegaard js at moszumanska.debian.org
Mon Jan 27 22:22:41 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 4609d482f2845dee5d3a5c3226cd0c036827b43e
Author: Vladimir Agafonkin <agafonkin at gmail.com>
Date:   Fri Aug 9 14:00:44 2013 +0300

    some tweaks to #1951
---
 src/map/Map.js                 |  8 ++++----
 src/map/handler/Map.BoxZoom.js | 19 +++++++++++--------
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/map/Map.js b/src/map/Map.js
index 744cf41..28a2ca5 100644
--- a/src/map/Map.js
+++ b/src/map/Map.js
@@ -676,10 +676,10 @@ L.Map = L.Class.extend({
 	},
 
 	_onMouseClick: function (e) {
-		if (!this._loaded ||
-			(!e._simulated && this.dragging && this.dragging.moved()) ||
-			(!e._simulated && this.boxZoom  && this.boxZoom.zoomed()) ||
-		        L.DomEvent._skipped(e)) { return; }
+		if (!this._loaded || (!e._simulated &&
+		        ((this.dragging && this.dragging.moved()) ||
+		         (this.boxZoom  && this.boxZoom.moved()))) ||
+		            L.DomEvent._skipped(e)) { return; }
 
 		this.fire('preclick');
 		this._fireMouseEvent(e);
diff --git a/src/map/handler/Map.BoxZoom.js b/src/map/handler/Map.BoxZoom.js
index db61baf..4817c9c 100644
--- a/src/map/handler/Map.BoxZoom.js
+++ b/src/map/handler/Map.BoxZoom.js
@@ -12,7 +12,7 @@ L.Map.BoxZoom = L.Handler.extend({
 		this._map = map;
 		this._container = map._container;
 		this._pane = map._panes.overlayPane;
-		this._zoomed = false;
+		this._moved = false;
 	},
 
 	addHooks: function () {
@@ -21,13 +21,16 @@ L.Map.BoxZoom = L.Handler.extend({
 
 	removeHooks: function () {
 		L.DomEvent.off(this._container, 'mousedown', this._onMouseDown);
-		this._zoomed = false;
+		this._moved = false;
 	},
-	zoomed: function () {
-		return this._zoomed;
+
+	moved: function () {
+		return this._moved;
 	},
+
 	_onMouseDown: function (e) {
-		this._zoomed = false;
+		this._moved = false;
+
 		if (!e.shiftKey || ((e.which !== 1) && (e.button !== 1))) { return false; }
 
 		L.DomUtil.disableTextSelection();
@@ -61,9 +64,9 @@ L.Map.BoxZoom = L.Handler.extend({
 		        Math.min(layerPoint.y, startPoint.y));
 
 		L.DomUtil.setPosition(box, newPos);
-		if (!this._zoomed) {
-			this._zoomed = true;
-		}
+
+		this._moved = true;
+
 		// TODO refactor: remove hardcoded 4 pixels
 		box.style.width  = (Math.max(0, Math.abs(offset.x) - 4)) + 'px';
 		box.style.height = (Math.max(0, Math.abs(offset.y) - 4)) + 'px';

-- 
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