forked from MTSR/mapserver
js/css cleanup
This commit is contained in:
parent
560f01dc7a
commit
f0d6d7c19b
@ -32,6 +32,8 @@ func (this *Listener) OnEvent(eventtype string, o interface{}) {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.ctx.WebEventbus.Emit("mapobjects-cleared", block.Pos)
|
||||||
|
|
||||||
for id, name := range block.BlockMapping {
|
for id, name := range block.BlockMapping {
|
||||||
for k, v := range this.objectlisteners {
|
for k, v := range this.objectlisteners {
|
||||||
if k == name {
|
if k == name {
|
||||||
@ -46,7 +48,7 @@ func (this *Listener) OnEvent(eventtype string, o interface{}) {
|
|||||||
|
|
||||||
if obj != nil {
|
if obj != nil {
|
||||||
this.ctx.Objectdb.AddMapData(obj)
|
this.ctx.Objectdb.AddMapData(obj)
|
||||||
this.ctx.WebEventbus.Emit("mapobject", obj)
|
this.ctx.WebEventbus.Emit("mapobject-created", obj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} //z
|
} //z
|
||||||
|
15
server/static/css/custom.css
Normal file
15
server/static/css/custom.css
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
body {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#image-map {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-custom-display {
|
||||||
|
background: #fff;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
@ -5,25 +5,8 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||||
<meta name="theme-color" content="#000">
|
<meta name="theme-color" content="#000">
|
||||||
<link rel="stylesheet" href="css/leaflet.css"/>
|
<link rel="stylesheet" href="css/leaflet.css"/>
|
||||||
|
<link rel="stylesheet" href="css/custom.css"/>
|
||||||
<title>Minetest Mapserver</title>
|
<title>Minetest Mapserver</title>
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#image-map {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leaflet-custom-display {
|
|
||||||
background: #fff;
|
|
||||||
padding: 5px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="image-map"></div>
|
<div id="image-map"></div>
|
||||||
|
@ -1,17 +1,33 @@
|
|||||||
var WebSocketChannel = (function(){
|
var WebSocketChannel = (function(){
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
var wsUrl = location.protocol.replace("http", "ws") + "//" + location.host + location.pathname.substring(0, location.pathname.lastIndexOf("/")) + "/api/ws";
|
||||||
|
|
||||||
function connect(){
|
function connect(){
|
||||||
var wsUrl = location.protocol.replace("http", "ws") + "//" + location.host + location.pathname.substring(0, location.pathname.lastIndexOf("/")) + "/api/ws";
|
|
||||||
var ws = new WebSocket(wsUrl);
|
var ws = new WebSocket(wsUrl);
|
||||||
|
|
||||||
ws.onmessage = function(e){
|
ws.onmessage = function(e){
|
||||||
var event = JSON.parse(e.data);
|
var event = JSON.parse(e.data);
|
||||||
|
|
||||||
if (event.type == "rendered-tile"){
|
if (event.type == "rendered-tile"){
|
||||||
|
//Update tiles
|
||||||
RealtimeTileLayer.update(event.data)
|
RealtimeTileLayer.update(event.data)
|
||||||
|
|
||||||
|
} else if (event.type == "mapobject-created"){
|
||||||
|
//TODO
|
||||||
|
console.log(event);
|
||||||
|
|
||||||
|
} else if (event.type == "mapobjects-cleared"){
|
||||||
|
//TODO
|
||||||
|
console.log(event);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ws.onerror = function(){
|
||||||
|
//reconnect after some time
|
||||||
|
setTimeout(connect, 1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user