Files
grecia/app/assets/javascripts/settings.js
Senén Rodero Rodríguez 289426c1c3 Destroy maps before leaving the current page
If we do not do this a map could be initialized twice times or more
when restoring a page with a map causing weird UI effects and
loading some map layers also twice times or more.

Need to add a maps array to be able to store all initialized
(visible) maps so we can destroy them when needed. Notice that
we are destroying maps also when admin settings tabs changes
(only visible ones), this is again to avoid to re-initialize map more
than once when users navigate through settings tabs, another
option to the settings issue could be to detect if the map was
already initialized to skip uneeded initialization.
2020-08-12 10:10:58 +02:00

14 lines
303 B
JavaScript

(function() {
"use strict";
App.Settings = {
initialize: function() {
$("#settings-tabs").on("change.zf.tabs", function() {
if ($("#tab-map-configuration:visible").length) {
App.Map.destroy();
App.Map.initialize();
}
});
}
};
}).call(this);