Skip to content

Commit 9d4c4c2

Browse files
committed
Upgrade to Leaflet 0.7.3
1 parent d3c5059 commit 9d4c4c2

File tree

3 files changed

+37
-26
lines changed

3 files changed

+37
-26
lines changed

CHANGES

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ CHANGELOG
55
0.13.3 (unreleased)
66
-------------------
77

8-
- Nothing changed yet.
8+
* Upgrade to Leaflet 0.7.3
99

1010

1111
0.13.2 (2014-04-15)

leaflet/static/leaflet/leaflet-src.js

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
var oldL = window.L,
88
L = {};
99

10-
L.version = '0.7.2';
10+
L.version = '0.7.3';
1111

1212
// define Leaflet for Node module pattern loaders, including Browserify
1313
if (typeof module === 'object' && typeof module.exports === 'object') {
@@ -2104,13 +2104,13 @@ L.Map = L.Class.extend({
21042104
var loading = !this._loaded;
21052105
this._loaded = true;
21062106

2107+
this.fire('viewreset', {hard: !preserveMapOffset});
2108+
21072109
if (loading) {
21082110
this.fire('load');
21092111
this.eachLayer(this._layerAdd, this);
21102112
}
21112113

2112-
this.fire('viewreset', {hard: !preserveMapOffset});
2113-
21142114
this.fire('move');
21152115

21162116
if (zoomChanged || afterZoomAnim) {
@@ -5083,7 +5083,8 @@ L.Path = (L.Path.SVG && !window.L_PREFER_CANVAS) || !L.Browser.canvas ? L.Path :
50835083
}
50845084

50855085
this._requestUpdate();
5086-
5086+
5087+
this.fire('remove');
50875088
this._map = null;
50885089
},
50895090

@@ -6605,12 +6606,12 @@ L.DomEvent = {
66056606
var timeStamp = (e.timeStamp || e.originalEvent.timeStamp),
66066607
elapsed = L.DomEvent._lastClick && (timeStamp - L.DomEvent._lastClick);
66076608

6608-
// are they closer together than 1000ms yet more than 100ms?
6609+
// are they closer together than 500ms yet more than 100ms?
66096610
// Android typically triggers them ~300ms apart while multiple listeners
66106611
// on the same event should be triggered far faster;
66116612
// or check if click is simulated on the element, and if it is, reject any non-simulated events
66126613

6613-
if ((elapsed && elapsed > 100 && elapsed < 1000) || (e.target._simulatedClick && !e._simulated)) {
6614+
if ((elapsed && elapsed > 100 && elapsed < 500) || (e.target._simulatedClick && !e._simulated)) {
66146615
L.DomEvent.stop(e);
66156616
return;
66166617
}
@@ -6708,6 +6709,7 @@ L.Draggable = L.Class.extend({
67086709
offset = newPoint.subtract(this._startPoint);
67096710

67106711
if (!offset.x && !offset.y) { return; }
6712+
if (L.Browser.touch && Math.abs(offset.x) + Math.abs(offset.y) < 3) { return; }
67116713

67126714
L.DomEvent.preventDefault(e);
67136715

@@ -6718,7 +6720,8 @@ L.Draggable = L.Class.extend({
67186720
this._startPos = L.DomUtil.getPosition(this._element).subtract(offset);
67196721

67206722
L.DomUtil.addClass(document.body, 'leaflet-dragging');
6721-
L.DomUtil.addClass((e.target || e.srcElement), 'leaflet-drag-target');
6723+
this._lastTarget = e.target || e.srcElement;
6724+
L.DomUtil.addClass(this._lastTarget, 'leaflet-drag-target');
67226725
}
67236726

67246727
this._newPos = this._startPos.add(offset);
@@ -6734,9 +6737,13 @@ L.Draggable = L.Class.extend({
67346737
this.fire('drag');
67356738
},
67366739

6737-
_onUp: function (e) {
6740+
_onUp: function () {
67386741
L.DomUtil.removeClass(document.body, 'leaflet-dragging');
6739-
L.DomUtil.removeClass((e.target || e.srcElement), 'leaflet-drag-target');
6742+
6743+
if (this._lastTarget) {
6744+
L.DomUtil.removeClass(this._lastTarget, 'leaflet-drag-target');
6745+
this._lastTarget = null;
6746+
}
67406747

67416748
for (var i in L.Draggable.MOVE) {
67426749
L.DomEvent
@@ -7391,7 +7398,7 @@ L.Map.TouchZoom = L.Handler.extend({
73917398
center = map.layerPointToLatLng(origin),
73927399
zoom = map.getScaleZoom(this._scale);
73937400

7394-
map._animateZoom(center, zoom, this._startCenter, this._scale, this._delta);
7401+
map._animateZoom(center, zoom, this._startCenter, this._scale, this._delta, false, true);
73957402
},
73967403

73977404
_onTouchEnd: function () {
@@ -8376,8 +8383,8 @@ L.Control.Layers = L.Control.extend({
83768383

83778384
onRemove: function (map) {
83788385
map
8379-
.off('layeradd', this._onLayerChange)
8380-
.off('layerremove', this._onLayerChange);
8386+
.off('layeradd', this._onLayerChange, this)
8387+
.off('layerremove', this._onLayerChange, this);
83818388
},
83828389

83838390
addBaseLayer: function (layer, name) {
@@ -8918,9 +8925,11 @@ L.Map.include(!L.DomUtil.TRANSITION ? {} : {
89188925
return true;
89198926
},
89208927

8921-
_animateZoom: function (center, zoom, origin, scale, delta, backwards) {
8928+
_animateZoom: function (center, zoom, origin, scale, delta, backwards, forTouchZoom) {
89228929

8923-
this._animatingZoom = true;
8930+
if (!forTouchZoom) {
8931+
this._animatingZoom = true;
8932+
}
89248933

89258934
// put transform transition on all layers with leaflet-zoom-animated class
89268935
L.DomUtil.addClass(this._mapPane, 'leaflet-zoom-anim');
@@ -8934,14 +8943,16 @@ L.Map.include(!L.DomUtil.TRANSITION ? {} : {
89348943
L.Draggable._disabled = true;
89358944
}
89368945

8937-
this.fire('zoomanim', {
8938-
center: center,
8939-
zoom: zoom,
8940-
origin: origin,
8941-
scale: scale,
8942-
delta: delta,
8943-
backwards: backwards
8944-
});
8946+
L.Util.requestAnimFrame(function () {
8947+
this.fire('zoomanim', {
8948+
center: center,
8949+
zoom: zoom,
8950+
origin: origin,
8951+
scale: scale,
8952+
delta: delta,
8953+
backwards: backwards
8954+
});
8955+
}, this);
89458956
},
89468957

89478958
_onZoomTransitionEnd: function () {

0 commit comments

Comments
 (0)