Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

check if path is already in front in bringToFront, same for bringToBack

  • Loading branch information...
commit fe9516579e9b12facab65ae53a44879e305aa9ff 1 parent 2aa3037
@mourner mourner authored
Showing with 11 additions and 5 deletions.
  1. +11 −5 src/layer/vector/Path.SVG.js
View
16 src/layer/vector/Path.SVG.js
@@ -8,16 +8,22 @@ L.Path = L.Path.extend({
},
bringToFront: function () {
- if (this._container) {
- this._map._pathRoot.appendChild(this._container);
+ var root = this._map._pathRoot,
+ path = this._container;
+
+ if (path && root.lastChild !== path) {
+ root.appendChild(path);
}
return this;
},
bringToBack: function () {
- if (this._container) {
- var root = this._map._pathRoot;
- root.insertBefore(this._container, root.firstChild);
+ var root = this._map._pathRoot,
+ path = this._container,
+ first = root.firstChild;
+
+ if (path && first !== path) {
+ root.insertBefore(path, first);
}
return this;
},
Please sign in to comment.
Something went wrong with that request. Please try again.