Update to Leaflet 0.7.3
authorTom Hughes <tom@compton.nu>
Fri, 23 May 2014 09:43:24 +0000 (10:43 +0100)
committerTom Hughes <tom@compton.nu>
Fri, 23 May 2014 09:43:43 +0000 (10:43 +0100)
Vendorfile
vendor/assets/leaflet/leaflet.js

index 0cca405..c2267a6 100644 (file)
@@ -11,13 +11,13 @@ folder 'vendor/assets' do
   end
 
   folder 'leaflet' do
   end
 
   folder 'leaflet' do
-    file 'leaflet.js', 'http://cdn.leafletjs.com/leaflet-0.7.2/leaflet-src.js'
-    file 'leaflet.css', 'http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css'
+    file 'leaflet.js', 'http://cdn.leafletjs.com/leaflet-0.7.3/leaflet-src.js'
+    file 'leaflet.css', 'http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css'
 
     [ 'layers.png', 'layers-2x.png',
       'marker-icon.png', 'marker-icon-2x.png',
       'marker-shadow.png' ].each do |image|
 
     [ 'layers.png', 'layers-2x.png',
       'marker-icon.png', 'marker-icon-2x.png',
       'marker-shadow.png' ].each do |image|
-      file "images/#{image}", "http://cdn.leafletjs.com/leaflet-0.7.2/images/#{image}"
+      file "images/#{image}", "http://cdn.leafletjs.com/leaflet-0.7.3/images/#{image}"
     end
 
     from 'git://github.com/kajic/leaflet-locationfilter.git' do
     end
 
     from 'git://github.com/kajic/leaflet-locationfilter.git' do
index e40bfbf..4947090 100644 (file)
@@ -7,7 +7,7 @@
 var oldL = window.L,
     L = {};
 
 var oldL = window.L,
     L = {};
 
-L.version = '0.7.2';
+L.version = '0.7.3';
 
 // define Leaflet for Node module pattern loaders, including Browserify
 if (typeof module === 'object' && typeof module.exports === 'object') {
 
 // define Leaflet for Node module pattern loaders, including Browserify
 if (typeof module === 'object' && typeof module.exports === 'object') {
@@ -2104,13 +2104,13 @@ L.Map = L.Class.extend({
                var loading = !this._loaded;
                this._loaded = true;
 
                var loading = !this._loaded;
                this._loaded = true;
 
+               this.fire('viewreset', {hard: !preserveMapOffset});
+
                if (loading) {
                        this.fire('load');
                        this.eachLayer(this._layerAdd, this);
                }
 
                if (loading) {
                        this.fire('load');
                        this.eachLayer(this._layerAdd, this);
                }
 
-               this.fire('viewreset', {hard: !preserveMapOffset});
-
                this.fire('move');
 
                if (zoomChanged || afterZoomAnim) {
                this.fire('move');
 
                if (zoomChanged || afterZoomAnim) {
@@ -5083,7 +5083,8 @@ L.Path = (L.Path.SVG && !window.L_PREFER_CANVAS) || !L.Browser.canvas ? L.Path :
                }
 
                this._requestUpdate();
                }
 
                this._requestUpdate();
-
+               
+               this.fire('remove');
                this._map = null;
        },
 
                this._map = null;
        },
 
@@ -6605,12 +6606,12 @@ L.DomEvent = {
                var timeStamp = (e.timeStamp || e.originalEvent.timeStamp),
                        elapsed = L.DomEvent._lastClick && (timeStamp - L.DomEvent._lastClick);
 
                var timeStamp = (e.timeStamp || e.originalEvent.timeStamp),
                        elapsed = L.DomEvent._lastClick && (timeStamp - L.DomEvent._lastClick);
 
-               // are they closer together than 1000ms yet more than 100ms?
+               // are they closer together than 500ms yet more than 100ms?
                // Android typically triggers them ~300ms apart while multiple listeners
                // on the same event should be triggered far faster;
                // or check if click is simulated on the element, and if it is, reject any non-simulated events
 
                // Android typically triggers them ~300ms apart while multiple listeners
                // on the same event should be triggered far faster;
                // or check if click is simulated on the element, and if it is, reject any non-simulated events
 
-               if ((elapsed && elapsed > 100 && elapsed < 1000) || (e.target._simulatedClick && !e._simulated)) {
+               if ((elapsed && elapsed > 100 && elapsed < 500) || (e.target._simulatedClick && !e._simulated)) {
                        L.DomEvent.stop(e);
                        return;
                }
                        L.DomEvent.stop(e);
                        return;
                }
@@ -6708,6 +6709,7 @@ L.Draggable = L.Class.extend({
                    offset = newPoint.subtract(this._startPoint);
 
                if (!offset.x && !offset.y) { return; }
                    offset = newPoint.subtract(this._startPoint);
 
                if (!offset.x && !offset.y) { return; }
+               if (L.Browser.touch && Math.abs(offset.x) + Math.abs(offset.y) < 3) { return; }
 
                L.DomEvent.preventDefault(e);
 
 
                L.DomEvent.preventDefault(e);
 
@@ -6718,7 +6720,8 @@ L.Draggable = L.Class.extend({
                        this._startPos = L.DomUtil.getPosition(this._element).subtract(offset);
 
                        L.DomUtil.addClass(document.body, 'leaflet-dragging');
                        this._startPos = L.DomUtil.getPosition(this._element).subtract(offset);
 
                        L.DomUtil.addClass(document.body, 'leaflet-dragging');
-                       L.DomUtil.addClass((e.target || e.srcElement), 'leaflet-drag-target');
+                       this._lastTarget = e.target || e.srcElement;
+                       L.DomUtil.addClass(this._lastTarget, 'leaflet-drag-target');
                }
 
                this._newPos = this._startPos.add(offset);
                }
 
                this._newPos = this._startPos.add(offset);
@@ -6734,9 +6737,13 @@ L.Draggable = L.Class.extend({
                this.fire('drag');
        },
 
                this.fire('drag');
        },
 
-       _onUp: function (e) {
+       _onUp: function () {
                L.DomUtil.removeClass(document.body, 'leaflet-dragging');
                L.DomUtil.removeClass(document.body, 'leaflet-dragging');
-               L.DomUtil.removeClass((e.target || e.srcElement), 'leaflet-drag-target');
+
+               if (this._lastTarget) {
+                       L.DomUtil.removeClass(this._lastTarget, 'leaflet-drag-target');
+                       this._lastTarget = null;
+               }
 
                for (var i in L.Draggable.MOVE) {
                        L.DomEvent
 
                for (var i in L.Draggable.MOVE) {
                        L.DomEvent
@@ -7391,7 +7398,7 @@ L.Map.TouchZoom = L.Handler.extend({
                    center = map.layerPointToLatLng(origin),
                    zoom = map.getScaleZoom(this._scale);
 
                    center = map.layerPointToLatLng(origin),
                    zoom = map.getScaleZoom(this._scale);
 
-               map._animateZoom(center, zoom, this._startCenter, this._scale, this._delta);
+               map._animateZoom(center, zoom, this._startCenter, this._scale, this._delta, false, true);
        },
 
        _onTouchEnd: function () {
        },
 
        _onTouchEnd: function () {
@@ -8376,8 +8383,8 @@ L.Control.Layers = L.Control.extend({
 
        onRemove: function (map) {
                map
 
        onRemove: function (map) {
                map
-                   .off('layeradd', this._onLayerChange)
-                   .off('layerremove', this._onLayerChange);
+                   .off('layeradd', this._onLayerChange, this)
+                   .off('layerremove', this._onLayerChange, this);
        },
 
        addBaseLayer: function (layer, name) {
        },
 
        addBaseLayer: function (layer, name) {
@@ -8918,9 +8925,11 @@ L.Map.include(!L.DomUtil.TRANSITION ? {} : {
                return true;
        },
 
                return true;
        },
 
-       _animateZoom: function (center, zoom, origin, scale, delta, backwards) {
+       _animateZoom: function (center, zoom, origin, scale, delta, backwards, forTouchZoom) {
 
 
-               this._animatingZoom = true;
+               if (!forTouchZoom) {
+                       this._animatingZoom = true;
+               }
 
                // put transform transition on all layers with leaflet-zoom-animated class
                L.DomUtil.addClass(this._mapPane, 'leaflet-zoom-anim');
 
                // put transform transition on all layers with leaflet-zoom-animated class
                L.DomUtil.addClass(this._mapPane, 'leaflet-zoom-anim');
@@ -8934,14 +8943,16 @@ L.Map.include(!L.DomUtil.TRANSITION ? {} : {
                        L.Draggable._disabled = true;
                }
 
                        L.Draggable._disabled = true;
                }
 
-               this.fire('zoomanim', {
-                       center: center,
-                       zoom: zoom,
-                       origin: origin,
-                       scale: scale,
-                       delta: delta,
-                       backwards: backwards
-               });
+               L.Util.requestAnimFrame(function () {
+                       this.fire('zoomanim', {
+                               center: center,
+                               zoom: zoom,
+                               origin: origin,
+                               scale: scale,
+                               delta: delta,
+                               backwards: backwards
+                       });
+               }, this);
        },
 
        _onZoomTransitionEnd: function () {
        },
 
        _onZoomTransitionEnd: function () {