update build

This commit is contained in:
Vladimir Agafonkin 2013-05-29 12:10:44 +03:00
parent 6387f20206
commit 47b1d51d30
2 changed files with 47 additions and 29 deletions

66
dist/leaflet-src.js vendored
View File

@ -55,8 +55,9 @@ L.Util = {
}, },
stamp: (function () { stamp: (function () {
var lastId = 0, key = '_leaflet_id'; var lastId = 0,
return function (/*Object*/ obj) { key = '_leaflet_id';
return function (obj) {
obj[key] = obj[key] || ++lastId; obj[key] = obj[key] || ++lastId;
return obj[key]; return obj[key];
}; };
@ -352,8 +353,8 @@ L.Mixin.Events = {
// store listeners of a particular context in a separate hash (if it has an id) // store listeners of a particular context in a separate hash (if it has an id)
// gives a major performance boost when removing thousands of map layers // gives a major performance boost when removing thousands of map layers
indexKey = type + '_idx', indexKey = type + '_idx';
indexLenKey = indexKey + '_len', indexLenKey = indexKey + '_len';
typeIndex = events[indexKey] = events[indexKey] || {}; typeIndex = events[indexKey] = events[indexKey] || {};
@ -464,7 +465,7 @@ L.Mixin.Events = {
typeIndex = events[type + '_idx']; typeIndex = events[type + '_idx'];
for (contextId in typeIndex) { for (contextId in typeIndex) {
listeners = typeIndex[contextId]; listeners = typeIndex[contextId].slice();
if (listeners) { if (listeners) {
for (i = 0, len = listeners.length; i < len; i++) { for (i = 0, len = listeners.length; i < len; i++) {
@ -899,6 +900,19 @@ L.DomUtil = {
left += docBody.scrollLeft || docEl.scrollLeft || 0; left += docBody.scrollLeft || docEl.scrollLeft || 0;
break; break;
} }
if (pos === 'relative' && !el.offsetLeft) {
var width = L.DomUtil.getStyle(el, 'width'),
maxWidth = L.DomUtil.getStyle(el, 'max-width');
if (width !== 'none' || maxWidth !== 'none') {
var r = el.getBoundingClientRect();
left += r.left + el.clientLeft;
}
break;
}
el = el.offsetParent; el = el.offsetParent;
} while (el); } while (el);
@ -1195,6 +1209,8 @@ L.LatLngBounds = function (southWest, northEast) { // (LatLng, LatLng) or (LatLn
L.LatLngBounds.prototype = { L.LatLngBounds.prototype = {
// extend the bounds to contain the given point or bounds // extend the bounds to contain the given point or bounds
extend: function (obj) { // (LatLng) or (LatLngBounds) extend: function (obj) { // (LatLng) or (LatLngBounds)
if (!obj) { return this; }
if (typeof obj[0] === 'number' || typeof obj[0] === 'string' || obj instanceof L.LatLng) { if (typeof obj[0] === 'number' || typeof obj[0] === 'string' || obj instanceof L.LatLng) {
obj = L.latLng(obj); obj = L.latLng(obj);
} else { } else {
@ -2550,7 +2566,11 @@ L.TileLayer = L.Class.extend({
var className = 'leaflet-tile-container leaflet-zoom-animated'; var className = 'leaflet-tile-container leaflet-zoom-animated';
this._bgBuffer = L.DomUtil.create('div', className, this._container); this._bgBuffer = L.DomUtil.create('div', className, this._container);
this._bgBuffer.style.zIndex = 1;
this._tileContainer = L.DomUtil.create('div', className, this._container); this._tileContainer = L.DomUtil.create('div', className, this._container);
this._tileContainer.style.zIndex = 2;
} else { } else {
this._tileContainer = this._container; this._tileContainer = this._container;
} }
@ -2655,11 +2675,11 @@ L.TileLayer = L.Class.extend({
var options = this.options; var options = this.options;
if (!options.continuousWorld && options.noWrap) { if (!options.continuousWorld) {
var limit = this._getWrapTileNum(); var limit = this._getWrapTileNum();
// don't load if exceeds world bounds // don't load if exceeds world bounds
if (tilePoint.x < 0 || tilePoint.x >= limit || if ((options.noWrap && (tilePoint.x < 0 || tilePoint.x >= limit)) ||
tilePoint.y < 0 || tilePoint.y >= limit) { return false; } tilePoint.y < 0 || tilePoint.y >= limit) { return false; }
} }
@ -3762,7 +3782,7 @@ L.Popup = L.Class.extend({
if (this._animated) { if (this._animated) {
events.zoomanim = this._zoomAnimation; events.zoomanim = this._zoomAnimation;
} }
if (this._map.options.closePopupOnClick) { if ('closeOnClick' in this.options ? this.options.closeOnClick : this._map.options.closePopupOnClick) {
events.preclick = this._close; events.preclick = this._close;
} }
if (this.options.keepInView) { if (this.options.keepInView) {
@ -5095,8 +5115,8 @@ L.LineUtil = {
return false; return false;
// other cases // other cases
} else { } else {
codeOut = codeA || codeB, codeOut = codeA || codeB;
p = this._getEdgeIntersection(a, b, codeOut, bounds), p = this._getEdgeIntersection(a, b, codeOut, bounds);
newCode = this._getBitCode(p, bounds); newCode = this._getBitCode(p, bounds);
if (codeOut === codeA) { if (codeOut === codeA) {
@ -7049,7 +7069,7 @@ L.Map.TouchZoom = L.Handler.extend({
center = map.layerPointToLatLng(origin), center = map.layerPointToLatLng(origin),
zoom = map.getScaleZoom(this._scale); zoom = map.getScaleZoom(this._scale);
map._animateZoom(center, zoom, this._startCenter, this._scale, this._delta, true); map._animateZoom(center, zoom, this._startCenter, this._scale, this._delta);
}, },
_onTouchEnd: function () { _onTouchEnd: function () {
@ -7079,7 +7099,7 @@ L.Map.TouchZoom = L.Handler.extend({
zoom = map._limitZoom(oldZoom + roundZoomDelta), zoom = map._limitZoom(oldZoom + roundZoomDelta),
scale = map.getZoomScale(zoom) / this._scale; scale = map.getZoomScale(zoom) / this._scale;
map._animateZoom(center, zoom, origin, scale, null, true); map._animateZoom(center, zoom, origin, scale);
}, },
_getScaleOrigin: function () { _getScaleOrigin: function () {
@ -8408,7 +8428,7 @@ 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) {
this._animatingZoom = true; this._animatingZoom = true;
@ -8429,8 +8449,7 @@ L.Map.include(!L.DomUtil.TRANSITION ? {} : {
zoom: zoom, zoom: zoom,
origin: origin, origin: origin,
scale: scale, scale: scale,
delta: delta, delta: delta
backwards: backwards
}); });
}, },
@ -8466,8 +8485,7 @@ L.TileLayer.include({
this._prepareBgBuffer(); this._prepareBgBuffer();
} }
var transform = L.DomUtil.TRANSFORM, var bg = this._bgBuffer;
bg = this._bgBuffer;
if (firstFrame) { if (firstFrame) {
//prevent bg buffer from clearing right after zoom //prevent bg buffer from clearing right after zoom
@ -8477,12 +8495,10 @@ L.TileLayer.include({
L.Util.falseFn(bg.offsetWidth); L.Util.falseFn(bg.offsetWidth);
} }
var scaleStr = L.DomUtil.getScaleString(e.scale, e.origin), var transform = L.DomUtil.TRANSFORM,
oldTransform = bg.style[transform]; initialTransform = e.delta ? L.DomUtil.getTranslateString(e.delta) : bg.style[transform];
bg.style[transform] = e.backwards ? bg.style[transform] = initialTransform + ' ' + L.DomUtil.getScaleString(e.scale, e.origin);
(e.delta ? L.DomUtil.getTranslateString(e.delta) : oldTransform) + ' ' + scaleStr :
scaleStr + ' ' + oldTransform;
}, },
_endZoomAnim: function () { _endZoomAnim: function () {
@ -8517,8 +8533,10 @@ L.TileLayer.include({
// if foreground layer doesn't have many tiles but bg layer does, // if foreground layer doesn't have many tiles but bg layer does,
// keep the existing bg layer and just zoom it some more // keep the existing bg layer and just zoom it some more
if (bg && this._getLoadedTilesPercentage(bg) > 0.5 && var bgLoaded = this._getLoadedTilesPercentage(bg),
this._getLoadedTilesPercentage(front) < 0.5) { frontLoaded = this._getLoadedTilesPercentage(front);
if (bg && bgLoaded > 0.5 && frontLoaded < 0.5) {
front.style.visibility = 'hidden'; front.style.visibility = 'hidden';
this._stopLoadingImages(front); this._stopLoadingImages(front);

8
dist/leaflet.js vendored

File diff suppressed because one or more lines are too long