evoverbeeke / beniatlas-repository

1 stars 3 forks source link

button functionality #5

Closed evoverbeeke closed 9 years ago

evoverbeeke commented 9 years ago

@acabunoc I realized that before putting up any other issues (the chloropleth issue still isn't resolved), I should probably resolve the button functionality. Here is what I've been experimenting with but the boolean approach isn't working. https://github.com/evoverbeeke/beniatlas-respository/blob/master/javascript/beniatlas.js#L786

It's complicated because I only want layers to be added to the map if two buttons are pressed (a place button and a layer button). The buttons need to be radio style but I'd also like to be able to toggle them on/off as well. The reason is that the button is turning on two different layers of data depending on the scale that is selected. I try to explain the logic below:

onclick button x x = true x siblings = false if x AND y = true, then add specific map layer else remove specific map layer

onclick button y y = true y siblings = false if y AND x = true, then add specific map layer else remove specific map layer

evoverbeeke commented 9 years ago

@acabunoc I believe I have partially resolved the button functionality. It was so simple I can't believe I didn't think of it. It was as simple as establishing an empty variable called "scale" and then depending on the view selected, redefine the variable to be 'world', 'drc', 'northkivu', 'beniregion', and 'benicity'. Then the conflict data only shows if the variable has the correct definition. I still have to resolve the radio selection element though.

abbycabs commented 9 years ago

I'll take a look tonight! Hahah, sometimes the smallest things cause the weirdest bugs

evoverbeeke commented 9 years ago

I'm happy to say this issue is completely resolved! https://github.com/evoverbeeke/beniatlas-repository/blob/master/javascript/buttonfunctionality.js