zorostang / chicago_bike_equity

Visualization and analysis of Chicago bike lanes. An effort to determine how the bike lane installations are divided among the entire city.
MIT License
20 stars 14 forks source link

Create a global zindex object for layer management #30

Open rguico opened 9 years ago

rguico commented 9 years ago

We need to manage which layers are on top of other ones better, instead of defaulting to "whichever one we checked last".

The best way to do this is probably a global variable, something like the following...

var ZINDEX = Object.freeze({
    'densityBase': 1,
    'densityHighlighted': 2,
    'bikeLanes': 3
});

// set the layer zIndex
layer.setZIndex(ZINDEX.densityBase);
stevevance commented 9 years ago

There's a Leaflet method to do this, I think. autoZIndex

I believe that when it's set to true, which is the default, then the layers maintain their zIndex.