From f902b28ecf842c382181f37e3932fe9c343aba77 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 19 Jul 2014 12:51:03 +0100 Subject: Handle markers coresponding to a feature on mutiple levels --- leaflet-indoor.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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); + } + } } } }; -- cgit v1.2.3