fix hinting error, update build

This commit is contained in:
Vladimir Agafonkin 2013-06-03 12:39:28 +03:00
parent c54b6c13b3
commit aaad3cbe2f
3 changed files with 64 additions and 43 deletions

61
dist/leaflet-src.js vendored
View File

@ -1670,10 +1670,9 @@ L.Map = L.Class.extend({
layer.on('load', this._onTileLayerLoad, this); layer.on('load', this._onTileLayerLoad, this);
} }
this.whenReady(function () { if (this._loaded) {
layer.onAdd(this); this._layerAdd(layer);
this.fire('layeradd', {layer: layer}); }
}, this);
return this; return this;
}, },
@ -1683,7 +1682,10 @@ L.Map = L.Class.extend({
if (!this._layers[id]) { return; } if (!this._layers[id]) { return; }
if (this._loaded) {
layer.onRemove(this); layer.onRemove(this);
this.fire('layerremove', {layer: layer});
}
delete this._layers[id]; delete this._layers[id];
if (this._zoomBoundLayers[id]) { if (this._zoomBoundLayers[id]) {
@ -1698,7 +1700,7 @@ L.Map = L.Class.extend({
layer.off('load', this._onTileLayerLoad, this); layer.off('load', this._onTileLayerLoad, this);
} }
return this.fire('layerremove', {layer: layer}); return this;
}, },
hasLayer: function (layer) { hasLayer: function (layer) {
@ -2059,6 +2061,7 @@ L.Map = L.Class.extend({
if (loading) { if (loading) {
this.fire('load'); this.fire('load');
this.eachLayer(this._layerAdd, this);
} }
this.fire('viewreset', {hard: !preserveMapOffset}); this.fire('viewreset', {hard: !preserveMapOffset});
@ -2200,6 +2203,11 @@ L.Map = L.Class.extend({
return this; return this;
}, },
_layerAdd: function (layer) {
layer.onAdd(this);
this.fire('layeradd', {layer: layer});
},
// private methods for getting map state // private methods for getting map state
@ -3213,15 +3221,15 @@ L.Icon = L.Class.extend({
L.setOptions(this, options); L.setOptions(this, options);
}, },
createIcon: function () { createIcon: function (oldIcon) {
return this._createIcon('icon'); return this._createIcon('icon', oldIcon);
}, },
createShadow: function () { createShadow: function (oldIcon) {
return this._createIcon('shadow'); return this._createIcon('shadow', oldIcon);
}, },
_createIcon: function (name) { _createIcon: function (name, oldIcon) {
var src = this._getIconUrl(name); var src = this._getIconUrl(name);
if (!src) { if (!src) {
@ -3231,7 +3239,12 @@ L.Icon = L.Class.extend({
return null; return null;
} }
var img = this._createImg(src); var img;
if (!oldIcon) {
img = this._createImg(src);
} else {
img = this._createImg(src, oldIcon);
}
this._setIconStyles(img, name); this._setIconStyles(img, name);
return img; return img;
@ -3265,14 +3278,17 @@ L.Icon = L.Class.extend({
} }
}, },
_createImg: function (src) { _createImg: function (src, el) {
var el;
if (!L.Browser.ie6) { if (!L.Browser.ie6) {
if (!el) {
el = document.createElement('img'); el = document.createElement('img');
}
el.src = src; el.src = src;
} else { } else {
if (!el) {
el = document.createElement('div'); el = document.createElement('div');
}
el.style.filter = el.style.filter =
'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '")'; 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '")';
} }
@ -3424,9 +3440,6 @@ L.Marker = L.Class.extend({
}, },
setIcon: function (icon) { setIcon: function (icon) {
if (this._map) {
this._removeIcon();
}
this.options.icon = icon; this.options.icon = icon;
@ -3454,8 +3467,12 @@ L.Marker = L.Class.extend({
classToAdd = animation ? 'leaflet-zoom-animated' : 'leaflet-zoom-hide', classToAdd = animation ? 'leaflet-zoom-animated' : 'leaflet-zoom-hide',
needOpacityUpdate = false; needOpacityUpdate = false;
if (!this._icon) { var reuseIcon = this._icon;
if (!reuseIcon) {
this._icon = options.icon.createIcon(); this._icon = options.icon.createIcon();
} else {
this._icon = this.options.icon.createIcon(this._icon);
}
if (options.title) { if (options.title) {
this._icon.title = options.title; this._icon.title = options.title;
@ -3471,15 +3488,17 @@ L.Marker = L.Class.extend({
.on(this._icon, 'mouseover', this._bringToFront, this) .on(this._icon, 'mouseover', this._bringToFront, this)
.on(this._icon, 'mouseout', this._resetZIndex, this); .on(this._icon, 'mouseout', this._resetZIndex, this);
} }
}
if (!this._shadow) { var reuseShadow = this._shadow;
if (!reuseShadow) {
this._shadow = options.icon.createShadow(); this._shadow = options.icon.createShadow();
if (this._shadow) { if (this._shadow) {
L.DomUtil.addClass(this._shadow, classToAdd); L.DomUtil.addClass(this._shadow, classToAdd);
needOpacityUpdate = (this.options.opacity < 1); needOpacityUpdate = (this.options.opacity < 1);
} }
} else {
this._shadow = this.options.icon.createShadow(this._shadow);
} }
if (needOpacityUpdate) { if (needOpacityUpdate) {
@ -3488,9 +3507,11 @@ L.Marker = L.Class.extend({
var panes = this._map._panes; var panes = this._map._panes;
if (!reuseIcon) {
panes.markerPane.appendChild(this._icon); panes.markerPane.appendChild(this._icon);
}
if (this._shadow) { if (this._shadow && !reuseShadow) {
panes.shadowPane.appendChild(this._shadow); panes.shadowPane.appendChild(this._shadow);
} }
}, },

8
dist/leaflet.js vendored

File diff suppressed because one or more lines are too long