[Pkg-javascript-commits] [leaflet-markercluster] 28/479: Update leaflet (https://github.com/CloudMade/Leaflet/pull/810)
Jonas Smedegaard
dr at jones.dk
Thu Oct 16 16:00:05 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository leaflet-markercluster.
commit 808b58738f74d3dd156d40175c94940b164cc2e1
Author: danzel <danzel at localhost.geek.nz>
Date: Tue Jul 17 15:12:56 2012 +1200
Update leaflet (https://github.com/CloudMade/Leaflet/pull/810)
---
lib/leaflet-dist/leaflet-src.js | 250 +++++++++++++++++++++++++++-------------
lib/leaflet-dist/leaflet.css | 29 ++---
lib/leaflet-dist/leaflet.js | 4 +-
3 files changed, 185 insertions(+), 98 deletions(-)
diff --git a/lib/leaflet-dist/leaflet-src.js b/lib/leaflet-dist/leaflet-src.js
index 2b7624e..1abf7dd 100644
--- a/lib/leaflet-dist/leaflet-src.js
+++ b/lib/leaflet-dist/leaflet-src.js
@@ -1,6 +1,6 @@
/*
Copyright (c) 2010-2012, CloudMade, Vladimir Agafonkin
- Leaflet is a modern open-source JavaScript library for interactive maps.
+ Leaflet is an open-source JavaScript library for mobile-friendly interactive maps.
http://leaflet.cloudmade.com
*/
(function (window, undefined) {
@@ -336,6 +336,8 @@ L.Mixin.Events.fire = L.Mixin.Events.fireEvent;
ie6 = ie && !window.XMLHttpRequest,
webkit = ua.indexOf("webkit") !== -1,
gecko = ua.indexOf("gecko") !== -1,
+ //Terrible browser detection to work around a safari / iOS browser bug. See TileLayer._addTile and debug/hacks/jitter.html
+ safari = (ua.indexOf("safari") !== -1 || ua.indexOf("iphone") !== -1 || ua.indexOf("ipad") !== -1) && ua.indexOf("applewebkit") !== -1 && ua.indexOf("chrome") === -1,
opera = window.opera,
android = ua.indexOf("android") !== -1,
android23 = ua.search("android [23]") !== -1,
@@ -371,19 +373,11 @@ L.Mixin.Events.fire = L.Mixin.Events.fireEvent;
div = null;
return supported;
- }()),
- ieversion = ie && (function () {
- var re = new RegExp("msie ([0-9]{1,}[\\.0-9]{0,})");
- if (re.exec(ua) !== null) {
- return parseFloat(RegExp.$1);
- }
- return null;
- }());
+ }());
L.Browser = {
ua: ua,
ie: ie,
- iefilter: ie && ieversion < 9,
ie6: ie6,
webkit: webkit,
gecko: gecko,
@@ -391,6 +385,8 @@ L.Mixin.Events.fire = L.Mixin.Events.fireEvent;
android: android,
android23: android23,
+ safari: safari,
+
ie3d: ie3d,
webkit3d: webkit3d,
gecko3d: gecko3d,
@@ -724,10 +720,10 @@ L.DomUtil = {
},
setOpacity: function (el, value) {
- if (L.Browser.iefilter) {
- el.style.filter += value !== 1 ? 'alpha(opacity=' + Math.round(value * 100) + ')' : '';
- } else {
+ if ('opacity' in el.style) {
el.style.opacity = value;
+ } else if (L.Browser.ie) {
+ el.style.filter += value !== 1 ? 'alpha(opacity=' + Math.round(value * 100) + ')' : '';
}
},
@@ -1643,9 +1639,8 @@ L.Map = L.Class.extend({
L.DomEvent.on(this._container, 'click', this._onMouseClick, this);
- var events = ['dblclick', 'mousedown', 'mouseenter', 'mouseleave', 'mousemove', 'contextmenu'];
-
- var i, len;
+ var events = ['dblclick', 'mousedown', 'mouseup', 'mouseenter', 'mouseleave', 'mousemove', 'contextmenu'],
+ i, len;
for (i = 0, len = events.length; i < len; i++) {
L.DomEvent.on(this._container, events[i], this._fireMouseEvent, this);
@@ -1657,8 +1652,8 @@ L.Map = L.Class.extend({
},
_onResize: function () {
- // TODO cancel previous frame
- L.Util.requestAnimFrame(this.invalidateSize, this, false, this._container);
+ L.Util.cancelAnimFrame(this._resizeRequest);
+ this._resizeRequest = L.Util.requestAnimFrame(this.invalidateSize, this, false, this._container);
},
_onMouseClick: function (e) {
@@ -2146,7 +2141,8 @@ L.TileLayer = L.Class.extend({
// get unused tile - or create a new tile
var tile = this._getTile();
- L.DomUtil.setPosition(tile, tilePos, true);
+ //Chrome 20 layouts much faster with top/left (Verify with timeline, frames), Safari 5.1.7 and iOS 5.1.1 have display issues with top/left and requires transform instead. (Other browsers don't currently care)
+ L.DomUtil.setPosition(tile, tilePos, !L.Browser.safari);
this._tiles[key] = tile;
@@ -2288,7 +2284,12 @@ L.TileLayer.WMS = L.TileLayer.extend({
this._url = url;
var wmsParams = L.Util.extend({}, this.defaultWmsParams);
- wmsParams.width = wmsParams.height = this.options.tileSize;
+
+ if (options.detectRetina && window.devicePixelRatio > 1) {
+ wmsParams.width = wmsParams.height = this.options.tileSize * 2;
+ } else {
+ wmsParams.width = wmsParams.height = this.options.tileSize;
+ }
for (var i in options) {
// all keys that are not TileLayer options go to WMS params
@@ -2755,7 +2756,8 @@ L.Marker = L.Class.extend({
var options = this.options,
map = this._map,
animation = (map.options.zoomAnimation && map.options.markerZoomAnimation),
- classToAdd = animation ? 'leaflet-zoom-animated' : 'leaflet-zoom-hide';
+ classToAdd = animation ? 'leaflet-zoom-animated' : 'leaflet-zoom-hide',
+ needOpacityUpdate = false;
if (!this._icon) {
this._icon = options.icon.createIcon();
@@ -2765,7 +2767,7 @@ L.Marker = L.Class.extend({
}
this._initInteraction();
- this._updateOpacity();
+ needOpacityUpdate = true;
L.DomUtil.addClass(this._icon, classToAdd);
}
@@ -2774,9 +2776,14 @@ L.Marker = L.Class.extend({
if (this._shadow) {
L.DomUtil.addClass(this._shadow, classToAdd);
+ needOpacityUpdate = true;
}
}
+ if (needOpacityUpdate) {
+ this._updateOpacity();
+ }
+
var panes = this._map._panes;
panes.markerPane.appendChild(this._icon);
@@ -2863,8 +2870,11 @@ L.Marker = L.Class.extend({
}
},
- _updateOpacity: function (opacity) {
+ _updateOpacity: function () {
L.DomUtil.setOpacity(this._icon, this.options.opacity);
+ if (this._shadow) {
+ L.DomUtil.setOpacity(this._shadow, this.options.opacity);
+ }
}
});
@@ -2926,7 +2936,7 @@ L.Popup = L.Class.extend({
maxHeight: null,
autoPan: true,
closeButton: true,
- offset: new L.Point(0, 2),
+ offset: new L.Point(0, 6),
autoPanPadding: new L.Point(5, 5),
className: ''
},
@@ -2945,7 +2955,11 @@ L.Popup = L.Class.extend({
}
this._updateContent();
- L.DomUtil.setOpacity(this._container, 0);
+ var animFade = map.options.fadeAnimation;
+
+ if (animFade) {
+ L.DomUtil.setOpacity(this._container, 0);
+ }
map._panes.popupPane.appendChild(this._container);
map.on('viewreset', this._updatePosition, this);
@@ -2960,7 +2974,9 @@ L.Popup = L.Class.extend({
this._update();
- L.DomUtil.setOpacity(this._container, 1);
+ if (animFade) {
+ L.DomUtil.setOpacity(this._container, 1);
+ }
},
addTo: function (map) {
@@ -2968,6 +2984,11 @@ L.Popup = L.Class.extend({
return this;
},
+ openOn: function (map) {
+ map.openPopup(this);
+ return this;
+ },
+
onRemove: function (map) {
map._panes.popupPane.removeChild(this._container);
@@ -2979,7 +3000,9 @@ L.Popup = L.Class.extend({
zoomanim: this._zoomAnimation
}, this);
- L.DomUtil.setOpacity(this._container, 0);
+ if (map.options.fadeAnimation) {
+ L.DomUtil.setOpacity(this._container, 0);
+ }
this._map = null;
},
@@ -3016,6 +3039,7 @@ L.Popup = L.Class.extend({
if (this.options.closeButton) {
closeButton = this._closeButton = L.DomUtil.create('a', prefix + '-close-button', container);
closeButton.href = '#close';
+ closeButton.innerHTML = '×';
L.DomEvent.on(closeButton, 'click', this._onCloseButtonClick, this);
}
@@ -3181,7 +3205,7 @@ L.Marker.include({
},
bindPopup: function (content, options) {
- var anchor = this.options.icon.options.popupAnchor || new L.Point(0, 0);
+ var anchor = L.point(this.options.icon.options.popupAnchor) || new L.Point(0, 0);
if (options && options.offset) {
anchor = anchor.add(options.offset);
@@ -3390,7 +3414,11 @@ L.Path = L.Class.extend({
statics: {
// how much to extend the clip area around the map view
// (relative to its size, e.g. 0.5 is half the screen in each direction)
- CLIP_PADDING: 0.5
+ // set in such way that SVG element doesn't exceed 1280px (vector layers flicker on dragend if it is)
+ CLIP_PADDING: L.Browser.mobile ?
+ Math.max(0, Math.min(0.5,
+ (1280 / Math.max(window.innerWidth, window.innerHeight) - 1) / 2))
+ : 0.5
},
options: {
@@ -3578,10 +3606,6 @@ L.Path = L.Path.extend({
return;
}
- if (e.type === 'contextmenu') {
- L.DomEvent.preventDefault(e);
- }
-
this._fireMouseEvent(e);
},
@@ -3589,6 +3613,11 @@ L.Path = L.Path.extend({
if (!this.hasEventListeners(e.type)) {
return;
}
+
+ if (e.type === 'contextmenu') {
+ L.DomEvent.preventDefault(e);
+ }
+
var map = this._map,
containerPoint = map.mouseEventToContainerPoint(e),
layerPoint = map.containerPointToLayerPoint(containerPoint),
@@ -3682,10 +3711,13 @@ L.Map.include({
*/
L.Path.include({
+
bindPopup: function (content, options) {
+
if (!this._popup || this._popup.options !== options) {
this._popup = new L.Popup(options, this);
}
+
this._popup.setContent(content);
if (!this._openPopupAdded) {
@@ -3696,6 +3728,18 @@ L.Path.include({
return this;
},
+ openPopup: function (latlng) {
+
+ if (this._popup) {
+ latlng = latlng || this._latlng ||
+ this._latlngs[Math.floor(this._latlngs.length / 2)];
+
+ this._openPopup({latlng: latlng});
+ }
+
+ return this;
+ },
+
_openPopup: function (e) {
this._popup.setLatLng(e.latlng);
this._map.openPopup(this._popup);
@@ -3709,13 +3753,17 @@ L.Path.include({
*/
L.Browser.vml = (function () {
- var div = document.createElement('div');
- div.innerHTML = '<v:shape adj="1"/>';
+ try {
+ var div = document.createElement('div');
+ div.innerHTML = '<v:shape adj="1"/>';
- var shape = div.firstChild;
- shape.style.behavior = 'url(#default#VML)';
+ var shape = div.firstChild;
+ shape.style.behavior = 'url(#default#VML)';
- return shape && (typeof shape.adj === 'object');
+ return shape && (typeof shape.adj === 'object');
+ } catch (e) {
+ return false;
+ }
}());
L.Path = L.Browser.svg || !L.Browser.vml ? L.Path : L.Path.extend({
@@ -3829,6 +3877,45 @@ L.Path = (L.Path.SVG && !window.L_PREFER_CANVAS) || !L.Browser.canvas ? L.Path :
SVG: false
},
+ redraw: function () {
+ if (this._map) {
+ this.projectLatlngs();
+ this._requestUpdate();
+ }
+ return this;
+ },
+
+ setStyle: function (style) {
+ L.Util.setOptions(this, style);
+
+ if (this._map) {
+ this._updateStyle();
+ this._requestUpdate();
+ }
+ return this;
+ },
+
+ onRemove: function (map) {
+ map
+ .off('viewreset', this.projectLatlngs, this)
+ .off('moveend', this._updatePath, this);
+
+ this._requestUpdate();
+
+ this._map = null;
+ },
+
+ _requestUpdate: function () {
+ if (this._map) {
+ L.Util.cancelAnimFrame(this._fireMapMoveEnd);
+ this._updateRequest = L.Util.requestAnimFrame(this._fireMapMoveEnd, this._map);
+ }
+ },
+
+ _fireMapMoveEnd: function () {
+ this.fire('moveend');
+ },
+
_initElements: function () {
this._map._initPathRoot();
this._ctx = this._map._canvasCtx;
@@ -3910,14 +3997,7 @@ L.Path = (L.Path.SVG && !window.L_PREFER_CANVAS) || !L.Browser.canvas ? L.Path :
if (this._containsPoint(e.layerPoint)) {
this.fire('click', e);
}
- },
-
- onRemove: function (map) {
- map
- .off('viewreset', this._projectLatlngs, this)
- .off('moveend', this._updatePath, this)
- .fire('moveend');
- }
+ }
});
L.Map.include((L.Path.SVG && !window.L_PREFER_CANVAS) || !L.Browser.canvas ? {} : {
@@ -4338,6 +4418,8 @@ L.Polyline = L.Path.extend({
},
_updatePath: function () {
+ if (!this._map) { return; }
+
this._clipPoints();
this._simplifyPoints();
@@ -4516,6 +4598,14 @@ L.polygon = function (latlngs, options) {
L.MultiPolyline = createMulti(L.Polyline);
L.MultiPolygon = createMulti(L.Polygon);
+
+ L.multiPolyline = function (latlngs, options) {
+ return new L.MultiPolyline(latlngs, options);
+ };
+
+ L.multiPolygon = function (latlngs, options) {
+ return new L.MultiPolygon(latlngs, options);
+ };
}());
@@ -4775,7 +4865,7 @@ L.GeoJSON = L.FeatureGroup.extend({
},
addData: function (geojson) {
- var features = geojson.features,
+ var features = geojson instanceof Array ? geojson : geojson.features,
i, len;
if (features) {
@@ -5259,9 +5349,9 @@ L.Map.mergeOptions({
dragging: true,
inertia: !L.Browser.android23,
- inertiaDeceleration: L.Browser.touch ? 3000 : 2000, // px/s^2
- inertiaMaxSpeed: L.Browser.touch ? 1500 : 1000, // px/s
- inertiaThreshold: L.Browser.touch ? 32 : 16, // ms
+ inertiaDeceleration: 3000, // px/s^2
+ inertiaMaxSpeed: 1500, // px/s
+ inertiaThreshold: L.Browser.touch ? 32 : 14, // ms
// TODO refactor, move to CRS
worldCopyJump: true,
@@ -6074,7 +6164,9 @@ L.Control = L.Class.extend({
}
});
-
+L.control = function (options) {
+ return new L.Control(options);
+};
L.Map.include({
addControl: function (control) {
@@ -6148,6 +6240,10 @@ L.Map.addInitHook(function () {
}
});
+L.control.zoom = function (options) {
+ return new L.Control.Zoom(options);
+};
+
L.Control.Attribution = L.Control.extend({
options: {
position: 'bottomright',
@@ -6223,7 +6319,7 @@ L.Control.Attribution = L.Control.extend({
prefixAndAttribs.push(attribs.join(', '));
}
- this._container.innerHTML = prefixAndAttribs.join(' — ');
+ this._container.innerHTML = prefixAndAttribs.join(' — ');
},
_onLayerAdd: function (e) {
@@ -6249,6 +6345,10 @@ L.Map.addInitHook(function () {
}
});
+L.control.attribution = function (options) {
+ return new L.Control.Attribution(options);
+};
+
L.Control.Scale = L.Control.extend({
options: {
position: 'bottomleft',
@@ -6285,16 +6385,15 @@ L.Control.Scale = L.Control.extend({
_update: function () {
var bounds = this._map.getBounds(),
centerLat = bounds.getCenter().lat,
-
- left = new L.LatLng(centerLat, bounds.getSouthWest().lng),
- right = new L.LatLng(centerLat, bounds.getNorthEast().lng),
+ halfWorldMeters = new L.LatLng(centerLat, 0).distanceTo(new L.LatLng(centerLat, 180)),
+ dist = halfWorldMeters * (bounds.getNorthEast().lng - bounds.getSouthWest().lng) / 180,
size = this._map.getSize(),
options = this.options,
- maxMeters = 0;
+ maxMeters = 0;
if (size.x > 0) {
- maxMeters = left.distanceTo(right) * (options.maxWidth / size.x);
+ maxMeters = dist * (options.maxWidth / size.x);
}
if (options.metric && maxMeters) {
@@ -6341,12 +6440,15 @@ L.Control.Scale = L.Control.extend({
var pow10 = Math.pow(10, (Math.floor(num) + '').length - 1),
d = num / pow10;
- d = d >= 10 ? 10 : d >= 5 ? 5 : d >= 2 ? 2 : 1;
+ d = d >= 10 ? 10 : d >= 5 ? 5 : d >= 3 ? 3 : d >= 2 ? 2 : 1;
return pow10 * d;
}
});
+L.control.scale = function (options) {
+ return new L.Control.Scale(options);
+};
L.Control.Layers = L.Control.extend({
@@ -6523,6 +6625,9 @@ L.Control.Layers = L.Control.extend({
}
});
+L.control.layers = function (options) {
+ return new L.Control.Layers(options);
+};
L.Transition = L.Class.extend({
includes: L.Mixin.Events,
@@ -6692,11 +6797,8 @@ L.Transition = L.Transition.NATIVE ? L.Transition : L.Transition.extend({
TIMER: true,
EASINGS: {
- 'ease': [0.25, 0.1, 0.25, 1.0],
- 'linear': [0.0, 0.0, 1.0, 1.0],
- 'ease-in': [0.42, 0, 1.0, 1.0],
- 'ease-out': [0, 0, 0.58, 1.0],
- 'ease-in-out': [0.42, 0, 0.58, 1.0]
+ 'linear': function (t) { return t; },
+ 'ease-out': function (t) { return t * (2 - t); }
},
CUSTOM_PROPS_GETTERS: {
@@ -6715,12 +6817,7 @@ L.Transition = L.Transition.NATIVE ? L.Transition : L.Transition.extend({
this._el = el;
L.Util.extend(this.options, options);
- var easings = L.Transition.EASINGS[this.options.easing] || L.Transition.EASINGS.ease;
-
- this._p1 = new L.Point(0, 0);
- this._p2 = new L.Point(easings[0], easings[1]);
- this._p3 = new L.Point(easings[2], easings[3]);
- this._p4 = new L.Point(1, 1);
+ this._easing = L.Transition.EASINGS[this.options.easing] || L.Transition.EASINGS['ease-out'];
this._step = L.Util.bind(this._step, this);
this._interval = Math.round(1000 / this.options.fps);
@@ -6760,7 +6857,7 @@ L.Transition = L.Transition.NATIVE ? L.Transition : L.Transition.extend({
duration = this.options.duration * 1000;
if (elapsed < duration) {
- this._runFrame(this._cubicBezier(elapsed / duration));
+ this._runFrame(this._easing(elapsed / duration));
} else {
this._runFrame(1);
this._complete();
@@ -6789,19 +6886,6 @@ L.Transition = L.Transition.NATIVE ? L.Transition : L.Transition.extend({
_complete: function () {
clearInterval(this._timer);
this.fire('end');
- },
-
- _cubicBezier: function (t) {
- var a = Math.pow(1 - t, 3),
- b = 3 * Math.pow(1 - t, 2) * t,
- c = 3 * (1 - t) * Math.pow(t, 2),
- d = Math.pow(t, 3),
- p1 = this._p1.multiplyBy(a),
- p2 = this._p2.multiplyBy(b),
- p3 = this._p3.multiplyBy(c),
- p4 = this._p4.multiplyBy(d);
-
- return p1.add(p2).add(p3).add(p4).y;
}
});
diff --git a/lib/leaflet-dist/leaflet.css b/lib/leaflet-dist/leaflet.css
index 6817203..21c83ca 100644
--- a/lib/leaflet-dist/leaflet.css
+++ b/lib/leaflet-dist/leaflet.css
@@ -288,7 +288,7 @@
.leaflet-popup-tip-container {
margin: 0 auto;
width: 40px;
- height: 16px;
+ height: 20px;
position: relative;
overflow: hidden;
}
@@ -305,15 +305,21 @@
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
-.leaflet-popup-close-button {
+.leaflet-container a.leaflet-popup-close-button {
position: absolute;
- top: 8px;
- right: 8px;
-
- width: 10px;
- height: 10px;
-
- overflow: hidden;
+ top: 0;
+ right: 0;
+ padding: 4px 5px 0 0;
+ text-align: center;
+ width: 18px;
+ height: 14px;
+ font: 16px/14px Tahoma, Verdana, sans-serif;
+ color: #c3c3c3;
+ text-decoration: none;
+ font-weight: bold;
+ }
+.leaflet-container a.leaflet-popup-close-button:hover {
+ color: #999;
}
.leaflet-popup-content p {
margin: 18px 0;
@@ -362,7 +368,4 @@
}
.leaflet-popup-content {
font: 12px/1.4 "Helvetica Neue", Arial, Helvetica, sans-serif;
- }
-.leaflet-popup-close-button {
- background: white url(images/popup-close.png);
- }
+ }
\ No newline at end of file
diff --git a/lib/leaflet-dist/leaflet.js b/lib/leaflet-dist/leaflet.js
index 118de0e..aeaf4d9 100644
--- a/lib/leaflet-dist/leaflet.js
+++ b/lib/leaflet-dist/leaflet.js
@@ -1,6 +1,6 @@
/*
Copyright (c) 2010-2012, CloudMade, Vladimir Agafonkin
- Leaflet is a modern open-source JavaScript library for interactive maps.
+ Leaflet is an open-source JavaScript library for mobile-friendly interactive maps.
http://leaflet.cloudmade.com
*/
-(function(e,t){var n,r;typeof exports!=t+""?n=exports:(r=e.L,n={},n.noConflict=function(){return e.L=r,this},e.L=n),n.version="0.4",n.Util={extend:function(e){var t=Array.prototype.slice.call(arguments,1);for(var n=0,r=t.length,i;n<r;n++){i=t[n]||{};for(var s in i)i.hasOwnProperty(s)&&(e[s]=i[s])}return e},bind:function(e,t){var n=arguments.length>2?Array.prototype.slice.call(arguments,2):null;return function(){return e.apply(t,n||arguments)}},stamp:function(){var e=0,t="_leaflet_id";ret [...]
\ No newline at end of file
+(function(e,t){var n,r;typeof exports!=t+""?n=exports:(r=e.L,n={},n.noConflict=function(){return e.L=r,this},e.L=n),n.version="0.4",n.Util={extend:function(e){var t=Array.prototype.slice.call(arguments,1);for(var n=0,r=t.length,i;n<r;n++){i=t[n]||{};for(var s in i)i.hasOwnProperty(s)&&(e[s]=i[s])}return e},bind:function(e,t){var n=arguments.length>2?Array.prototype.slice.call(arguments,2):null;return function(){return e.apply(t,n||arguments)}},stamp:function(){var e=0,t="_leaflet_id";ret [...]
\ No newline at end of file
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/leaflet-markercluster.git
More information about the Pkg-javascript-commits
mailing list