Improved panning usability on marker-crowded maps, closed #506

This commit is contained in:
mourner 2012-02-21 12:32:11 +02:00
parent 495f4d3632
commit 10bb71fb2a
6 changed files with 21 additions and 11 deletions

View File

@ -16,6 +16,7 @@ An in-progress version being developed on the master branch.
#### Usabiliy improvements
* Drag-panning now works even when there are markers in the starting point (helps on maps with lots of markers). [#506](https://github.com/CloudMade/Leaflet/issues/506)
* Slightly improved default popup styling.
#### Breaking API changes
@ -44,6 +45,7 @@ An in-progress version being developed on the master branch.
* Added `contextmenu` event to vector layers (by [@ErrorProne](https://github.com/ErrorProne)). [#500](https://github.com/CloudMade/Leaflet/pull/500)
* Added chaining to `DomEvent` methods.
* Added `Map` `addHandler` method.
* Moved dragging cursor styles from JS code to CSS.
### Bug fixes

11
dist/leaflet-src.js vendored
View File

@ -2427,12 +2427,15 @@ L.Marker = L.Class.extend({
_onMouseClick: function (e) {
L.DomEvent.stopPropagation(e);
if (this.dragging && this.dragging.moved()) { return; }
if (this._map.dragging && this._map.dragging.moved()) { return; }
this.fire(e.type);
},
_fireMouseEvent: function (e) {
this.fire(e.type);
L.DomEvent.stopPropagation(e);
if (e.type !== 'mousedown') {
L.DomEvent.stopPropagation(e);
}
},
setOpacity: function (opacity) {
@ -4521,13 +4524,11 @@ L.Draggable = L.Class.extend({
},
_setMovingCursor: function () {
this._bodyCursor = document.body.style.cursor;
this._dragStartTarget.style.cursor = document.body.style.cursor = 'move';
document.body.className += ' leaflet-dragging';
},
_restoreCursor: function () {
document.body.style.cursor = this._bodyCursor;
this._dragStartTarget.style.cursor = '';
document.body.className = document.body.className.replace(/ leaflet-dragging/g, '');
},
_simulateEvent: function (type, e) {

6
dist/leaflet.css vendored
View File

@ -34,6 +34,12 @@
.leaflet-clickable {
cursor: pointer;
}
.leaflet-dragging {
cursor: move;
}
.leaflet-dragging .leaflet-clickable {
cursor: move;
}
.leaflet-container img {
max-width: none !important;
}

2
dist/leaflet.js vendored

File diff suppressed because one or more lines are too long

View File

@ -126,13 +126,11 @@ L.Draggable = L.Class.extend({
},
_setMovingCursor: function () {
this._bodyCursor = document.body.style.cursor;
this._dragStartTarget.style.cursor = document.body.style.cursor = 'move';
document.body.className += ' leaflet-dragging';
},
_restoreCursor: function () {
document.body.style.cursor = this._bodyCursor;
this._dragStartTarget.style.cursor = '';
document.body.className = document.body.className.replace(/ leaflet-dragging/g, '');
},
_simulateEvent: function (type, e) {

View File

@ -157,12 +157,15 @@ L.Marker = L.Class.extend({
_onMouseClick: function (e) {
L.DomEvent.stopPropagation(e);
if (this.dragging && this.dragging.moved()) { return; }
if (this._map.dragging && this._map.dragging.moved()) { return; }
this.fire(e.type);
},
_fireMouseEvent: function (e) {
this.fire(e.type);
L.DomEvent.stopPropagation(e);
if (e.type !== 'mousedown') {
L.DomEvent.stopPropagation(e);
}
},
setOpacity: function (opacity) {