various js/css fixes
This commit is contained in:
parent
cad7f07945
commit
d2dff6d73d
@ -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 {
|
||||
|
@ -15,7 +15,10 @@
|
||||
<title>Minetest Mapserver</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<div id="app">
|
||||
<br>
|
||||
<h5 style="text-align: center;">Starting mapserver...</h5>
|
||||
</div>
|
||||
|
||||
<!-- libraries -->
|
||||
<script src="js/lib/mithril.min.js"></script>
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
});
|
||||
|
@ -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
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user