diff options
-rw-r--r-- | leaflet-indoor.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/leaflet-indoor.js b/leaflet-indoor.js index ee3fd52..c49f624 100644 --- a/leaflet-indoor.js +++ b/leaflet-indoor.js @@ -42,7 +42,22 @@ L.Indoor = L.Class.extend({ layer.fire('click', e); }); - layers[feature.properties.level].addLayer(marker); + var level = options.getLevel(feature); + + if (typeof(level) === 'undefined') { + console.warn("level undefined for"); + console.log(feature); + } else { + function addToLevel(level) { + layers[level].addLayer(marker); + } + + if (L.Util.isArray(level)) { + level.forEach(addToLevel); + } else { + addToLevel(level); + } + } } } }; |