Restructure to use separate scenes
Uses pseudo-router logic...
This commit is contained in:
11
js/map.js
11
js/map.js
@@ -1,7 +1,6 @@
|
||||
// Global Leaflet and ATON
|
||||
|
||||
import {config} from '../config.js';
|
||||
import Scene from './scene.js';
|
||||
import AppState from './state.js';
|
||||
|
||||
const Map = {};
|
||||
@@ -29,7 +28,7 @@ Map.init = function(mapContainerId) {
|
||||
const popup = this.domParser.parseFromString(marker.popup, 'text/html')
|
||||
.querySelector('div');
|
||||
popup.querySelector('button').onclick = () => {
|
||||
Scene.openScene(marker);
|
||||
this.goToScene(marker.uri);
|
||||
map.getContainer().classList.toggle('d-none');
|
||||
};
|
||||
|
||||
@@ -41,4 +40,12 @@ Map.init = function(mapContainerId) {
|
||||
AppState.map = map;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {String} uri The scene's absolute URI (from config)
|
||||
*/
|
||||
Map.goToScene = function (uri) {
|
||||
location.href = uri;
|
||||
}
|
||||
|
||||
export default Map;
|
||||
Reference in New Issue
Block a user