Indicia-Team / media

Shared library of JavaScript code,
0 stars 2 forks source link

Work to allow basemap override and dynamic switching #11

Closed burkmarr closed 5 years ago

burkmarr commented 5 years ago

I updated jquery.IndiciaMapPanel.js to create the two new layers - dynamic1 and dynamic2. Dynamic1, for now, is actually an OSM layer (because I can't get OS to work on my setup) but needs changing to OS and testing before deployment. Dynamic2 is a Google Satellite layer.

I added a handler registered to the 'zoomend' event to switch between the two dynamic layers using OL setBaseLayer function. The zoom threshold at which the layers switch is currently hard-coded here. This is also responsible for switching the visibility of the layers' option controls on the OL layer switcher control so that it appears to the user as if there is only one layer. (I'm unsure about whether or not I have included this function in the best place for it.)

I updated indicia.functions.js to include code responsible for a couple of things. I'm not sure if this is the best place for this code. I wondered about having it in a separate JS file, but I was unsure of the mechanism for doing that and including the code.

First thing is to tie the two edit form options for the map base layers dynamic1 and dynamic2 together - so that if one is checked or unchecked, then the other is forced to match. I also decided to make one of these invisible as I thought it would be less confusing to the user.

Second thing was to look for the Drupal JS variable Drupal.settings.iform_user_ui_options.basemap_layers_override to hide the basemap options completely if it is set. I also test to see if this is a verification form and don't hide if it is, regardless of the whether or not the basemap override was applied.