label fixes

This commit is contained in:
Thomas Rudin 2019-02-26 21:19:01 +01:00
parent afef0e1aa5
commit b81ecde799
8 changed files with 25 additions and 24 deletions

View File

@ -16,7 +16,7 @@ local update_formspec = function(meta)
"button_exit[4,1;4,1;save;Save]" ..
-- col 2
"field[4,2.5;4,1;index;Index;" .. index .. "]"
"field[4,2.5;4,1;index;Index;" .. index .. "]" ..
"")
end
@ -25,11 +25,6 @@ end
minetest.register_node("mapserver:border", {
description = "Mapserver Border",
tiles = {
"mapserver_border.png",
"mapserver_border.png",
"mapserver_border.png",
"mapserver_border.png",
"mapserver_border.png",
"mapserver_border.png"
},
groups = {cracky=3,oddly_breakable_by_hand=3},

View File

@ -4,6 +4,8 @@ mapserver = {}
local MP = minetest.get_modpath("mapserver")
dofile(MP.."/poi.lua")
dofile(MP.."/train.lua")
dofile(MP.."/label.lua")
dofile(MP.."/border.lua")
-- optional mapserver-bridge stuff below
@ -26,7 +28,7 @@ if http then
print("[Mapserver] starting mapserver-bridge with endpoint: " .. mapserver_url)
dofile(MP .. "/bridge.lua")
mapserver.bridge_init(http, mapserver_url, mapserver_key)
else
print("[Mapserver] bridge not active, additional infos will not be visible on the map")

View File

@ -26,11 +26,6 @@ end
minetest.register_node("mapserver:label", {
description = "Mapserver Label",
tiles = {
"mapserver_label.png",
"mapserver_label.png",
"mapserver_label.png",
"mapserver_label.png",
"mapserver_label.png",
"mapserver_label.png"
},
groups = {cracky=3,oddly_breakable_by_hand=3},

View File

@ -26,11 +26,6 @@ end
minetest.register_node("mapserver:poi", {
description = "Mapserver POI",
tiles = {
"mapserver_poi.png",
"mapserver_poi.png",
"mapserver_poi.png",
"mapserver_poi.png",
"mapserver_poi.png",
"mapserver_poi.png"
},
groups = {cracky=3,oddly_breakable_by_hand=3},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 291 B

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 291 B

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -27,11 +27,6 @@ end
minetest.register_node("mapserver:train", {
description = "Mapserver Train",
tiles = {
"mapserver_train.png",
"mapserver_train.png",
"mapserver_train.png",
"mapserver_train.png",
"mapserver_train.png",
"mapserver_train.png"
},
groups = {cracky=3,oddly_breakable_by_hand=3},

View File

@ -1,15 +1,34 @@
'use strict';
var LabelIcon = L.Icon.extend({
initialize: function(options) {
L.Icon.prototype.initialize.call(this, options);
},
createIcon: function (oldIcon) {
var div = document.createElement('div'),
options = this.options;
div.innerHTML = options.html || "";
return div;
}
});
var LabelOverlay = AbstractIconOverlay.extend({
initialize: function(wsChannel, layerMgr) {
AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "label");
},
getIcon: function(lbl){
return L.divIcon({html: lbl.attributes.text});
return new LabelIcon({
iconAnchor: [15, 50],
iconSize: [30, 100],
html: "<svg height='30' width='100'><text x='0' y='15'>" + lbl.attributes.text + "</text></svg>"
});
},
createPopup: function(lbl){
return "<pre>" + lbl.attributes.text + "</pre>";
return "<p>" + lbl.attributes.text + "</p>";
}
});