c3nav._levelControl is apparently not yet set at some point when _pause may be called

This commit is contained in:
Gwendolyn 2023-12-27 13:34:13 +01:00
parent e15d178102
commit 509670ec2a

View file

@ -1931,8 +1931,10 @@ c3nav = {
window.clearTimeout(c3nav._searchable_locations_timer) window.clearTimeout(c3nav._searchable_locations_timer)
c3nav._searchable_locations_timer = null; c3nav._searchable_locations_timer = null;
} }
c3nav.resume_level = c3nav._levelControl.currentLevel; if (c3nav._levelControl) {
c3nav._levelControl.setLevel(null); c3nav.resume_level = c3nav._levelControl.currentLevel;
c3nav._levelControl.setLevel(null);
}
}, },
_resume: function() { _resume: function() {
if (c3nav._fetch_updates_timer === null) { if (c3nav._fetch_updates_timer === null) {
@ -2034,6 +2036,7 @@ LevelControl = L.Control.extend({
}, },
setLevel: function (id) { setLevel: function (id) {
console.log('setting level (from/to)', this.currentLevel, id)
if (id === this.currentLevel) return true; if (id === this.currentLevel) return true;
if (id !== null && this._tileLayers[id] === undefined) return false; if (id !== null && this._tileLayers[id] === undefined) return false;