From 27155d0bbc31ad7431478a5dedfaaeeecb8aee54 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 11 Mar 2015 10:44:38 +0000 Subject: 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. --- leaflet-indoor.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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); + } } }); -- cgit v1.2.3