fix chaining in marker methods, close #1176

This commit is contained in:
Vladimir Agafonkin 2012-12-10 18:22:19 +02:00
parent 5ec66e984d
commit c05e15f956

View File

@ -62,12 +62,14 @@ L.Marker = L.Class.extend({
this.update();
this.fire('move', { latlng: this._latlng });
return this.fire('move', { latlng: this._latlng });
},
setZIndexOffset: function (offset) {
this.options.zIndexOffset = offset;
this.update();
return this;
},
setIcon: function (icon) {
@ -81,13 +83,17 @@ L.Marker = L.Class.extend({
this._initIcon();
this.update();
}
return this;
},
update: function () {
if (!this._icon) { return; }
if (this._icon) {
var pos = this._map.latLngToLayerPoint(this._latlng).round();
this._setPos(pos);
}
var pos = this._map.latLngToLayerPoint(this._latlng).round();
this._setPos(pos);
return this;
},
_initIcon: function () {