aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2015-03-11 10:44:38 +0000
committerChristopher Baines <mail@cbaines.net>2015-03-11 10:44:38 +0000
commit27155d0bbc31ad7431478a5dedfaaeeecb8aee54 (patch)
treee68e222c4b7bd31afb86fb078ae243ff96c32c50
parentad7e8ab707826935cac7220258c416367b96e1ed (diff)
downloadleaflet-indoor-27155d0bbc31ad7431478a5dedfaaeeecb8aee54.tar
leaflet-indoor-27155d0bbc31ad7431478a5dedfaaeeecb8aee54.tar.gz
Add resetStyle method
Also add the related utility method. Both of these come from the Leaflet GeoJSON class, copied such as to minimise the chance of the code breaking due to changes in Leaflet.
-rw-r--r--leaflet-indoor.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/leaflet-indoor.js b/leaflet-indoor.js
index c49f624..aede15c 100644
--- a/leaflet-indoor.js
+++ b/leaflet-indoor.js
@@ -168,6 +168,20 @@ L.Indoor = L.Class.extend({
}
this._level = level;
+ },
+ resetStyle: function (layer) {
+ // reset any custom styles
+ layer.options = layer.defaultOptions;
+ this._setLayerStyle(layer, this.options.style);
+ return this;
+ },
+ _setLayerStyle: function (layer, style) {
+ if (typeof style === 'function') {
+ style = style(layer.feature);
+ }
+ if (layer.setStyle) {
+ layer.setStyle(style);
+ }
}
});