diff --git a/static/css/custom.css b/static/css/custom.css
index 108c255..3f5f1b3 100644
--- a/static/css/custom.css
+++ b/static/css/custom.css
@@ -1,5 +1,5 @@
body {
- height: 98%;
+ height: 100%;
margin: 0;
}
@@ -10,8 +10,6 @@ body {
.full-screen {
width: 100%;
height: 100%;
- border: 1px solid #ccc;
- margin-bottom: 10px;
}
.leaflet-custom-display {
diff --git a/static/index.html b/static/index.html
index 2d012d3..1c467ce 100644
--- a/static/index.html
+++ b/static/index.html
@@ -15,7 +15,10 @@
Minetest Mapserver
-
+
+
+
Starting mapserver...
+
diff --git a/static/js/components/Map.js b/static/js/components/Map.js
index 2156550..54c3f74 100644
--- a/static/js/components/Map.js
+++ b/static/js/components/Map.js
@@ -1,9 +1,9 @@
import layerManager from '../LayerManager.js';
import { createMap } from '../map/MapFactory.js';
-function setupMap(vnode){
+function setupMap(vnode, id){
const map = createMap(
- vnode.dom,
+ id,
layerManager.getCurrentLayer().id,
+vnode.attrs.zoom,
+vnode.attrs.lat,
@@ -27,12 +27,17 @@ function setupMap(vnode){
}
export default {
+
+ oninit(){
+ this.id = "map_" + Math.floor(Math.random() * 10000);
+ },
+
view(){
- return m("div", { class: "full-screen" });
+ return m("div", { class: "full-screen", id: this.id });
},
oncreate(vnode){
- this.map = setupMap(vnode);
+ this.map = setupMap(vnode, this.id);
},
onupdate(vnode){
@@ -40,7 +45,7 @@ export default {
//layer changed, recreate map
this.map.remove();
layerManager.setLayerId(vnode.attrs.layerId);
- this.map = setupMap(vnode);
+ this.map = setupMap(vnode, this.id);
} else {
//position/zoom change
diff --git a/static/js/main.js b/static/js/main.js
index da9fe08..a24ce8f 100644
--- a/static/js/main.js
+++ b/static/js/main.js
@@ -17,5 +17,5 @@ getConfig()
m.route(document.getElementById("app"), "/map/0/12/0/0", routes);
})
.catch(e => {
- document.getElementById("app").innerHTML = JSON.stringify(e);
+ document.getElementById("app").innerHTML = e;
});
diff --git a/static/js/routes.js b/static/js/routes.js
index b715183..d12e8df 100644
--- a/static/js/routes.js
+++ b/static/js/routes.js
@@ -2,14 +2,7 @@
import Map from './components/Map.js';
import Search from './components/Search.js';
-var Home = {
- view: function() {
- return "Home";
- }
-};
-
export default {
- "/": Home,
"/map/:layerId/:zoom/:lon/:lat": Map,
"/search/:query": Search
};