aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2014-07-19 12:51:03 +0100
committerChristopher Baines <mail@cbaines.net>2014-07-19 12:51:03 +0100
commitf902b28ecf842c382181f37e3932fe9c343aba77 (patch)
tree937b83d7f9b65f304762da10572cd829d82724f4
parentbe1267e96abb6b3c23ecf2496ae135d8b736323c (diff)
downloadleaflet-indoor-f902b28ecf842c382181f37e3932fe9c343aba77.tar
leaflet-indoor-f902b28ecf842c382181f37e3932fe9c343aba77.tar.gz
Handle markers coresponding to a feature on mutiple levels
-rw-r--r--leaflet-indoor.js17
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);
+ }
+ }
}
}
};