]> git.openstreetmap.org Git - rails.git/commitdiff
Update to Leaflet 0.7.4
authorTom Hughes <tom@compton.nu>
Tue, 1 Sep 2015 18:08:44 +0000 (19:08 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 1 Sep 2015 18:08:44 +0000 (19:08 +0100)
Vendorfile
vendor/assets/leaflet/leaflet.css
vendor/assets/leaflet/leaflet.js

index 097f557aadd317993c677458e3f2d7231bf72ae4..e2502ffce48506446f3391bad37d4a49b7f7c6f7 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.3/leaflet-src.js'
-    file 'leaflet.css', 'http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css'
+    file 'leaflet.js', 'http://cdn.leafletjs.com/leaflet-0.7.4/leaflet-src.js'
+    file 'leaflet.css', 'http://cdn.leafletjs.com/leaflet-0.7.4/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.3/images/#{image}"
+      file "images/#{image}", "http://cdn.leafletjs.com/leaflet-0.7.4/images/#{image}"
     end
 
     from 'git://github.com/kajic/leaflet-locationfilter.git' do
     end
 
     from 'git://github.com/kajic/leaflet-locationfilter.git' do
index ac0cd174df7fac89d74525d1b06dc79b38af7964..346fab996cb763958cbcd73fc7ecd7b17bc424cc 100644 (file)
@@ -1,16 +1,12 @@
 /* required styles */\r
 \r
 /* required styles */\r
 \r
-.leaflet-map-pane,\r
+.leaflet-pane,\r
 .leaflet-tile,\r
 .leaflet-marker-icon,\r
 .leaflet-marker-shadow,\r
 .leaflet-tile,\r
 .leaflet-marker-icon,\r
 .leaflet-marker-shadow,\r
-.leaflet-tile-pane,\r
 .leaflet-tile-container,\r
 .leaflet-tile-container,\r
-.leaflet-overlay-pane,\r
-.leaflet-shadow-pane,\r
-.leaflet-marker-pane,\r
-.leaflet-popup-pane,\r
-.leaflet-overlay-pane svg,\r
+.leaflet-map-pane svg,\r
+.leaflet-map-pane canvas,\r
 .leaflet-zoom-box,\r
 .leaflet-image-layer,\r
 .leaflet-layer {\r
 .leaflet-zoom-box,\r
 .leaflet-image-layer,\r
 .leaflet-layer {\r
@@ -21,6 +17,7 @@
 .leaflet-container {\r
        overflow: hidden;\r
        -ms-touch-action: none;\r
 .leaflet-container {\r
        overflow: hidden;\r
        -ms-touch-action: none;\r
+       touch-action: none;\r
        }\r
 .leaflet-tile,\r
 .leaflet-marker-icon,\r
        }\r
 .leaflet-tile,\r
 .leaflet-marker-icon,\r
        -webkit-user-select: none;\r
           -moz-user-select: none;\r
                user-select: none;\r
        -webkit-user-select: none;\r
           -moz-user-select: none;\r
                user-select: none;\r
-       -webkit-user-drag: none;\r
+         -webkit-user-drag: none;\r
+       }\r
+/* Safari renders non-retina tile on retina better with this, but Chrome is worse */\r
+.leaflet-safari .leaflet-tile {\r
+       image-rendering: -webkit-optimize-contrast;\r
+       }\r
+/* hack that prevents hw layers "stretching" when loading new tiles */\r
+.leaflet-safari .leaflet-tile-container {\r
+       width: 1600px;\r
+       height: 1600px;\r
+       -webkit-transform-origin: 0 0;\r
        }\r
 .leaflet-marker-icon,\r
 .leaflet-marker-shadow {\r
        display: block;\r
        }\r
        }\r
 .leaflet-marker-icon,\r
 .leaflet-marker-shadow {\r
        display: block;\r
        }\r
-/* map is broken in FF if you have max-width: 100% on tiles */\r
-.leaflet-container img {\r
-       max-width: none !important;\r
-       }\r
-/* stupid Android 2 doesn't understand "max-width: none" properly */\r
+/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */\r
+/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */\r
+.leaflet-container .leaflet-overlay-pane svg,\r
+.leaflet-container .leaflet-marker-pane img,\r
+.leaflet-container .leaflet-tile-pane img,\r
 .leaflet-container img.leaflet-image-layer {\r
 .leaflet-container img.leaflet-image-layer {\r
-       max-width: 15000px !important;\r
+       max-width: none !important;\r
        }\r
 .leaflet-tile {\r
        filter: inherit;\r
        }\r
 .leaflet-tile {\r
        filter: inherit;\r
 .leaflet-zoom-box {\r
        width: 0;\r
        height: 0;\r
 .leaflet-zoom-box {\r
        width: 0;\r
        height: 0;\r
+       -moz-box-sizing: border-box;\r
+            box-sizing: border-box;\r
+       z-index: 800;\r
        }\r
 /* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */\r
 .leaflet-overlay-pane svg {\r
        -moz-user-select: none;\r
        }\r
 \r
        }\r
 /* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */\r
 .leaflet-overlay-pane svg {\r
        -moz-user-select: none;\r
        }\r
 \r
-.leaflet-tile-pane    { z-index: 2; }\r
-.leaflet-objects-pane { z-index: 3; }\r
-.leaflet-overlay-pane { z-index: 4; }\r
-.leaflet-shadow-pane  { z-index: 5; }\r
-.leaflet-marker-pane  { z-index: 6; }\r
-.leaflet-popup-pane   { z-index: 7; }\r
+.leaflet-pane         { z-index: 400; }\r
+\r
+.leaflet-tile-pane    { z-index: 200; }\r
+.leaflet-overlay-pane { z-index: 400; }\r
+.leaflet-shadow-pane  { z-index: 500; }\r
+.leaflet-marker-pane  { z-index: 600; }\r
+.leaflet-popup-pane   { z-index: 700; }\r
+\r
+.leaflet-map-pane canvas { z-index: 100; }\r
+.leaflet-map-pane svg    { z-index: 200; }\r
 \r
 .leaflet-vml-shape {\r
        width: 1px;\r
 \r
 .leaflet-vml-shape {\r
        width: 1px;\r
@@ -80,7 +94,7 @@
 \r
 .leaflet-control {\r
        position: relative;\r
 \r
 .leaflet-control {\r
        position: relative;\r
-       z-index: 7;\r
+       z-index: 800;\r
        pointer-events: auto;\r
        }\r
 .leaflet-top,\r
        pointer-events: auto;\r
        }\r
 .leaflet-top,\r
 \r
 /* zoom and fade animations */\r
 \r
 \r
 /* zoom and fade animations */\r
 \r
-.leaflet-fade-anim .leaflet-tile,\r
+.leaflet-fade-anim .leaflet-tile {\r
+       will-change: opacity;\r
+       }\r
 .leaflet-fade-anim .leaflet-popup {\r
        opacity: 0;\r
        -webkit-transition: opacity 0.2s linear;\r
 .leaflet-fade-anim .leaflet-popup {\r
        opacity: 0;\r
        -webkit-transition: opacity 0.2s linear;\r
             -o-transition: opacity 0.2s linear;\r
                transition: opacity 0.2s linear;\r
        }\r
             -o-transition: opacity 0.2s linear;\r
                transition: opacity 0.2s linear;\r
        }\r
-.leaflet-fade-anim .leaflet-tile-loaded,\r
 .leaflet-fade-anim .leaflet-map-pane .leaflet-popup {\r
        opacity: 1;\r
        }\r
 .leaflet-fade-anim .leaflet-map-pane .leaflet-popup {\r
        opacity: 1;\r
        }\r
-\r
+.leaflet-zoom-animated {\r
+       -webkit-transform-origin: 0 0;\r
+           -ms-transform-origin: 0 0;\r
+               transform-origin: 0 0;\r
+       }\r
+.leaflet-zoom-anim .leaflet-zoom-animated {\r
+       will-change: transform;\r
+       }\r
 .leaflet-zoom-anim .leaflet-zoom-animated {\r
        -webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);\r
           -moz-transition:    -moz-transform 0.25s cubic-bezier(0,0,0.25,1);\r
 .leaflet-zoom-anim .leaflet-zoom-animated {\r
        -webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);\r
           -moz-transition:    -moz-transform 0.25s cubic-bezier(0,0,0.25,1);\r
                transition:         transform 0.25s cubic-bezier(0,0,0.25,1);\r
        }\r
 .leaflet-zoom-anim .leaflet-tile,\r
                transition:         transform 0.25s cubic-bezier(0,0,0.25,1);\r
        }\r
 .leaflet-zoom-anim .leaflet-tile,\r
-.leaflet-pan-anim .leaflet-tile,\r
-.leaflet-touching .leaflet-zoom-animated {\r
+.leaflet-pan-anim .leaflet-tile {\r
        -webkit-transition: none;\r
           -moz-transition: none;\r
             -o-transition: none;\r
        -webkit-transition: none;\r
           -moz-transition: none;\r
             -o-transition: none;\r
 \r
 /* cursors */\r
 \r
 \r
 /* cursors */\r
 \r
-.leaflet-clickable {\r
+.leaflet-interactive {\r
        cursor: pointer;\r
        }\r
        cursor: pointer;\r
        }\r
-.leaflet-container {\r
+.leaflet-grab {\r
        cursor: -webkit-grab;\r
        cursor:    -moz-grab;\r
        }\r
        cursor: -webkit-grab;\r
        cursor:    -moz-grab;\r
        }\r
+.leaflet-crosshair,\r
+.leaflet-crosshair .leaflet-interactive {\r
+       cursor: crosshair;\r
+       }\r
 .leaflet-popup-pane,\r
 .leaflet-control {\r
        cursor: auto;\r
        }\r
 .leaflet-popup-pane,\r
 .leaflet-control {\r
        cursor: auto;\r
        }\r
-.leaflet-dragging .leaflet-container,\r
-.leaflet-dragging .leaflet-clickable {\r
+.leaflet-dragging .leaflet-grab,\r
+.leaflet-dragging .leaflet-grab .leaflet-interactive,\r
+.leaflet-dragging .leaflet-marker-draggable {\r
        cursor: move;\r
        cursor: -webkit-grabbing;\r
        cursor:    -moz-grabbing;\r
        cursor: move;\r
        cursor: -webkit-grabbing;\r
        cursor:    -moz-grabbing;\r
        color: #333;\r
        background: #fff;\r
        }\r
        color: #333;\r
        background: #fff;\r
        }\r
+.leaflet-control-layers-scrollbar {\r
+       overflow-y: scroll;\r
+       padding-right: 5px;\r
+       }\r
 .leaflet-control-layers-selector {\r
        margin-top: 2px;\r
        position: relative;\r
 .leaflet-control-layers-selector {\r
        margin-top: 2px;\r
        position: relative;\r
 .leaflet-popup-content-wrapper,\r
 .leaflet-popup-tip {\r
        background: white;\r
 .leaflet-popup-content-wrapper,\r
 .leaflet-popup-tip {\r
        background: white;\r
-\r
+       color: #333;\r
        box-shadow: 0 3px 14px rgba(0,0,0,0.4);\r
        }\r
 .leaflet-container a.leaflet-popup-close-button {\r
        box-shadow: 0 3px 14px rgba(0,0,0,0.4);\r
        }\r
 .leaflet-container a.leaflet-popup-close-button {\r
        top: 0;\r
        right: 0;\r
        padding: 4px 4px 0 0;\r
        top: 0;\r
        right: 0;\r
        padding: 4px 4px 0 0;\r
+       border: none;\r
        text-align: center;\r
        width: 18px;\r
        height: 14px;\r
        text-align: center;\r
        width: 18px;\r
        height: 14px;\r
index 4947090340a6588078c0ba8f791b05d7f3b83902..aecf2677ba664db88dab18925a9771c7aedffaf0 100644 (file)
@@ -7,7 +7,7 @@
 var oldL = window.L,
     L = {};
 
 var oldL = window.L,
     L = {};
 
-L.version = '0.7.3';
+L.version = '0.7.4';
 
 // 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') {
@@ -519,8 +519,7 @@ L.Mixin.Events.fire = L.Mixin.Events.fireEvent;
                gecko = ua.indexOf('gecko') !== -1,
 
            mobile = typeof orientation !== undefined + '',
                gecko = ua.indexOf('gecko') !== -1,
 
            mobile = typeof orientation !== undefined + '',
-           msPointer = window.navigator && window.navigator.msPointerEnabled &&
-                     window.navigator.msMaxTouchPoints && !window.PointerEvent,
+           msPointer = !window.PointerEvent && window.MSPointerEvent,
                pointer = (window.PointerEvent && window.navigator.pointerEnabled && window.navigator.maxTouchPoints) ||
                                  msPointer,
            retina = ('devicePixelRatio' in window && window.devicePixelRatio > 1) ||
                pointer = (window.PointerEvent && window.navigator.pointerEnabled && window.navigator.maxTouchPoints) ||
                                  msPointer,
            retina = ('devicePixelRatio' in window && window.devicePixelRatio > 1) ||
@@ -534,38 +533,8 @@ L.Mixin.Events.fire = L.Mixin.Events.fireEvent;
            opera3d = 'OTransition' in doc.style,
            any3d = !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d || opera3d) && !phantomjs;
 
            opera3d = 'OTransition' in doc.style,
            any3d = !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d || opera3d) && !phantomjs;
 
-
-       // PhantomJS has 'ontouchstart' in document.documentElement, but doesn't actually support touch.
-       // https://github.com/Leaflet/Leaflet/pull/1434#issuecomment-13843151
-
-       var touch = !window.L_NO_TOUCH && !phantomjs && (function () {
-
-               var startName = 'ontouchstart';
-
-               // IE10+ (We simulate these into touch* events in L.DomEvent and L.DomEvent.Pointer) or WebKit, etc.
-               if (pointer || (startName in doc)) {
-                       return true;
-               }
-
-               // Firefox/Gecko
-               var div = document.createElement('div'),
-                   supported = false;
-
-               if (!div.setAttribute) {
-                       return false;
-               }
-               div.setAttribute(startName, 'return;');
-
-               if (typeof div[startName] === 'function') {
-                       supported = true;
-               }
-
-               div.removeAttribute(startName);
-               div = null;
-
-               return supported;
-       }());
-
+       var touch = !window.L_NO_TOUCH && !phantomjs && (pointer || 'ontouchstart' in window ||
+               (window.DocumentTouch && document instanceof window.DocumentTouch));
 
        L.Browser = {
                ie: ie,
 
        L.Browser = {
                ie: ie,
@@ -1632,15 +1601,16 @@ L.Map = L.Class.extend({
                var paddingTL = L.point(options.paddingTopLeft || options.padding || [0, 0]),
                    paddingBR = L.point(options.paddingBottomRight || options.padding || [0, 0]),
 
                var paddingTL = L.point(options.paddingTopLeft || options.padding || [0, 0]),
                    paddingBR = L.point(options.paddingBottomRight || options.padding || [0, 0]),
 
-                   zoom = this.getBoundsZoom(bounds, false, paddingTL.add(paddingBR)),
-                   paddingOffset = paddingBR.subtract(paddingTL).divideBy(2),
+                   zoom = this.getBoundsZoom(bounds, false, paddingTL.add(paddingBR));
+
+               zoom = (options.maxZoom) ? Math.min(options.maxZoom, zoom) : zoom;
+
+               var paddingOffset = paddingBR.subtract(paddingTL).divideBy(2),
 
                    swPoint = this.project(bounds.getSouthWest(), zoom),
                    nePoint = this.project(bounds.getNorthEast(), zoom),
                    center = this.unproject(swPoint.add(nePoint).divideBy(2).add(paddingOffset), zoom);
 
 
                    swPoint = this.project(bounds.getSouthWest(), zoom),
                    nePoint = this.project(bounds.getNorthEast(), zoom),
                    center = this.unproject(swPoint.add(nePoint).divideBy(2).add(paddingOffset), zoom);
 
-               zoom = options && options.maxZoom ? Math.min(options.maxZoom, zoom) : zoom;
-
                return this.setView(center, zoom, options);
        },
 
                return this.setView(center, zoom, options);
        },
 
@@ -2782,7 +2752,7 @@ L.TileLayer = L.Class.extend({
                }
 
                if (options.bounds) {
                }
 
                if (options.bounds) {
-                       var tileSize = options.tileSize,
+                       var tileSize = this._getTileSize(),
                            nwPoint = tilePoint.multiplyBy(tileSize),
                            sePoint = nwPoint.add([tileSize, tileSize]),
                            nw = this._map.unproject(nwPoint),
                            nwPoint = tilePoint.multiplyBy(tileSize),
                            sePoint = nwPoint.add([tileSize, tileSize]),
                            nw = this._map.unproject(nwPoint),
@@ -3568,7 +3538,9 @@ L.Marker = L.Class.extend({
        update: function () {
                if (this._icon) {
                        var pos = this._map.latLngToLayerPoint(this._latlng).round();
        update: function () {
                if (this._icon) {
                        var pos = this._map.latLngToLayerPoint(this._latlng).round();
-                       this._setPos(pos);
+                       L.Util.requestAnimFrame(function () {
+                               this._setPos(pos);
+                       }, this);
                }
 
                return this;
                }
 
                return this;
@@ -4228,6 +4200,7 @@ L.Marker.include({
                if (content instanceof L.Popup) {
                        L.setOptions(content, options);
                        this._popup = content;
                if (content instanceof L.Popup) {
                        L.setOptions(content, options);
                        this._popup = content;
+                       content._source = this;
                } else {
                        this._popup = new L.Popup(options, this)
                                .setContent(content);
                } else {
                        this._popup = new L.Popup(options, this)
                                .setContent(content);
@@ -5114,6 +5087,13 @@ L.Path = (L.Path.SVG && !window.L_PREFER_CANVAS) || !L.Browser.canvas ? L.Path :
                if (options.fill) {
                        this._ctx.fillStyle = options.fillColor || options.color;
                }
                if (options.fill) {
                        this._ctx.fillStyle = options.fillColor || options.color;
                }
+
+               if (options.lineCap) {
+                       this._ctx.lineCap = options.lineCap;
+               }
+               if (options.lineJoin) {
+                       this._ctx.lineJoin = options.lineJoin;
+               }
        },
 
        _drawPath: function () {
        },
 
        _drawPath: function () {
@@ -5151,7 +5131,7 @@ L.Path = (L.Path.SVG && !window.L_PREFER_CANVAS) || !L.Browser.canvas ? L.Path :
 
                if (options.fill) {
                        ctx.globalAlpha = options.fillOpacity;
 
                if (options.fill) {
                        ctx.globalAlpha = options.fillOpacity;
-                       ctx.fill();
+                       ctx.fill(options.fillRule || 'evenodd');
                }
 
                if (options.stroke) {
                }
 
                if (options.stroke) {
@@ -5166,15 +5146,14 @@ L.Path = (L.Path.SVG && !window.L_PREFER_CANVAS) || !L.Browser.canvas ? L.Path :
 
        _initEvents: function () {
                if (this.options.clickable) {
 
        _initEvents: function () {
                if (this.options.clickable) {
-                       // TODO dblclick
                        this._map.on('mousemove', this._onMouseMove, this);
                        this._map.on('mousemove', this._onMouseMove, this);
-                       this._map.on('click', this._onClick, this);
+                       this._map.on('click dblclick contextmenu', this._fireMouseEvent, this);
                }
        },
 
                }
        },
 
-       _onClick: function (e) {
+       _fireMouseEvent: function (e) {
                if (this._containsPoint(e.layerPoint)) {
                if (this._containsPoint(e.layerPoint)) {
-                       this.fire('click', e);
+                       this.fire(e.type, e);
                }
        },
 
                }
        },
 
@@ -8952,10 +8931,13 @@ L.Map.include(!L.DomUtil.TRANSITION ? {} : {
                                delta: delta,
                                backwards: backwards
                        });
                                delta: delta,
                                backwards: backwards
                        });
+                       // horrible hack to work around a Chrome bug https://github.com/Leaflet/Leaflet/issues/3689
+                       setTimeout(L.bind(this._onZoomTransitionEnd, this), 250);
                }, this);
        },
 
        _onZoomTransitionEnd: function () {
                }, this);
        },
 
        _onZoomTransitionEnd: function () {
+               if (!this._animatingZoom) { return; }
 
                this._animatingZoom = false;
 
 
                this._animatingZoom = false;
 
@@ -9001,6 +8983,11 @@ L.TileLayer.include({
                // force reflow
                L.Util.falseFn(bg.offsetWidth);
 
                // force reflow
                L.Util.falseFn(bg.offsetWidth);
 
+               var zoom = this._map.getZoom();
+               if (zoom > this.options.maxZoom || zoom < this.options.minZoom) {
+                       this._clearBgBuffer();
+               }
+
                this._animating = false;
        },
 
                this._animating = false;
        },