Skip to content

Commit

Permalink
check if path is already in front in bringToFront, same for bringToBack
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner committed Aug 8, 2012
1 parent 2aa3037 commit fe95165
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/layer/vector/Path.SVG.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@ L.Path = L.Path.extend({
}, },


bringToFront: function () { bringToFront: function () {
if (this._container) { var root = this._map._pathRoot,
this._map._pathRoot.appendChild(this._container); path = this._container;

if (path && root.lastChild !== path) {
root.appendChild(path);
} }
return this; return this;
}, },


bringToBack: function () { bringToBack: function () {
if (this._container) { var root = this._map._pathRoot,
var root = this._map._pathRoot; path = this._container,
root.insertBefore(this._container, root.firstChild); first = root.firstChild;

if (path && first !== path) {
root.insertBefore(path, first);
} }
return this; return this;
}, },
Expand Down

0 comments on commit fe95165

Please sign in to comment.