various js/css fixes
This commit is contained in:
parent
cad7f07945
commit
d2dff6d73d
@ -1,5 +1,5 @@
|
|||||||
body {
|
body {
|
||||||
height: 98%;
|
height: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10,8 +10,6 @@ body {
|
|||||||
.full-screen {
|
.full-screen {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border: 1px solid #ccc;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.leaflet-custom-display {
|
.leaflet-custom-display {
|
||||||
|
@ -15,7 +15,10 @@
|
|||||||
<title>Minetest Mapserver</title>
|
<title>Minetest Mapserver</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app">
|
||||||
|
<br>
|
||||||
|
<h5 style="text-align: center;">Starting mapserver...</h5>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- libraries -->
|
<!-- libraries -->
|
||||||
<script src="js/lib/mithril.min.js"></script>
|
<script src="js/lib/mithril.min.js"></script>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import layerManager from '../LayerManager.js';
|
import layerManager from '../LayerManager.js';
|
||||||
import { createMap } from '../map/MapFactory.js';
|
import { createMap } from '../map/MapFactory.js';
|
||||||
|
|
||||||
function setupMap(vnode){
|
function setupMap(vnode, id){
|
||||||
const map = createMap(
|
const map = createMap(
|
||||||
vnode.dom,
|
id,
|
||||||
layerManager.getCurrentLayer().id,
|
layerManager.getCurrentLayer().id,
|
||||||
+vnode.attrs.zoom,
|
+vnode.attrs.zoom,
|
||||||
+vnode.attrs.lat,
|
+vnode.attrs.lat,
|
||||||
@ -27,12 +27,17 @@ function setupMap(vnode){
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
|
oninit(){
|
||||||
|
this.id = "map_" + Math.floor(Math.random() * 10000);
|
||||||
|
},
|
||||||
|
|
||||||
view(){
|
view(){
|
||||||
return m("div", { class: "full-screen" });
|
return m("div", { class: "full-screen", id: this.id });
|
||||||
},
|
},
|
||||||
|
|
||||||
oncreate(vnode){
|
oncreate(vnode){
|
||||||
this.map = setupMap(vnode);
|
this.map = setupMap(vnode, this.id);
|
||||||
},
|
},
|
||||||
|
|
||||||
onupdate(vnode){
|
onupdate(vnode){
|
||||||
@ -40,7 +45,7 @@ export default {
|
|||||||
//layer changed, recreate map
|
//layer changed, recreate map
|
||||||
this.map.remove();
|
this.map.remove();
|
||||||
layerManager.setLayerId(vnode.attrs.layerId);
|
layerManager.setLayerId(vnode.attrs.layerId);
|
||||||
this.map = setupMap(vnode);
|
this.map = setupMap(vnode, this.id);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//position/zoom change
|
//position/zoom change
|
||||||
|
@ -17,5 +17,5 @@ getConfig()
|
|||||||
m.route(document.getElementById("app"), "/map/0/12/0/0", routes);
|
m.route(document.getElementById("app"), "/map/0/12/0/0", routes);
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.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 Map from './components/Map.js';
|
||||||
import Search from './components/Search.js';
|
import Search from './components/Search.js';
|
||||||
|
|
||||||
var Home = {
|
|
||||||
view: function() {
|
|
||||||
return "Home";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
"/": Home,
|
|
||||||
"/map/:layerId/:zoom/:lon/:lat": Map,
|
"/map/:layerId/:zoom/:lon/:lat": Map,
|
||||||
"/search/:query": Search
|
"/search/:query": Search
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user