[Pkg-javascript-commits] [leaflet] 233/301: add leaflet-drag-target class to dragged elements, ref #2164, #1902

Jonas Smedegaard js at moszumanska.debian.org
Mon Jan 27 22:22:53 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 db446f3e468319039f038821ad4a547e351e6072
Author: Vladimir Agafonkin <agafonkin at gmail.com>
Date:   Wed Nov 13 12:56:00 2013 +0200

    add leaflet-drag-target class to dragged elements, ref #2164, #1902
---
 dist/leaflet.css                |  5 ++---
 src/dom/Draggable.js            | 12 +++++-------
 src/layer/marker/Marker.Drag.js |  2 --
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/dist/leaflet.css b/dist/leaflet.css
index 3e17bf6..9a9c81e 100644
--- a/dist/leaflet.css
+++ b/dist/leaflet.css
@@ -170,9 +170,8 @@
 .leaflet-control {
 	cursor: auto;
 	}
-.leaflet-dragging,
-.leaflet-dragging .leaflet-clickable,
-.leaflet-dragging .leaflet-container {
+.leaflet-dragging .leaflet-container,
+.leaflet-dragging .leaflet-clickable {
 	cursor: move;
 	cursor: -webkit-grabbing;
 	cursor:    -moz-grabbing;
diff --git a/src/dom/Draggable.js b/src/dom/Draggable.js
index 9c20fe2..fb451b9 100644
--- a/src/dom/Draggable.js
+++ b/src/dom/Draggable.js
@@ -91,9 +91,8 @@ L.Draggable = L.Class.extend({
 			this._moved = true;
 			this._startPos = L.DomUtil.getPosition(this._element).subtract(offset);
 
-			if (!L.Browser.touch) {
-				L.DomUtil.addClass(document.body, 'leaflet-dragging');
-			}
+			L.DomUtil.addClass(document.body, 'leaflet-dragging');
+			L.DomUtil.addClass(e.target, 'leaflet-drag-target');
 		}
 
 		this._newPos = this._startPos.add(offset);
@@ -109,10 +108,9 @@ L.Draggable = L.Class.extend({
 		this.fire('drag');
 	},
 
-	_onUp: function () {
-		if (!L.Browser.touch) {
-			L.DomUtil.removeClass(document.body, 'leaflet-dragging');
-		}
+	_onUp: function (e) {
+		L.DomUtil.removeClass(document.body, 'leaflet-dragging');
+		L.DomUtil.removeClass(e.target, 'leaflet-drag-target');
 
 		for (var i in L.Draggable.MOVE) {
 			L.DomEvent
diff --git a/src/layer/marker/Marker.Drag.js b/src/layer/marker/Marker.Drag.js
index f71fe8f..812439f 100644
--- a/src/layer/marker/Marker.Drag.js
+++ b/src/layer/marker/Marker.Drag.js
@@ -40,7 +40,6 @@ L.Handler.MarkerDrag = L.Handler.extend({
 		    .closePopup()
 		    .fire('movestart')
 		    .fire('dragstart');
-		L.DomUtil.addClass(this._marker._icon, 'leaflet-marker-dragging');
 	},
 
 	_onDrag: function () {
@@ -65,6 +64,5 @@ L.Handler.MarkerDrag = L.Handler.extend({
 		this._marker
 		    .fire('moveend')
 		    .fire('dragend', e);
-		L.DomUtil.removeClass(this._marker._icon, 'leaflet-marker-dragging');
 	}
 });

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