1
0
forked from MTSR/mapserver
mapserver/server/static/js/overlays/LabelOverlay.js

35 lines
816 B
JavaScript
Raw Normal View History

2019-02-08 17:12:40 +03:00
'use strict';
2019-02-26 23:19:01 +03:00
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;
}
});
2019-02-08 17:12:40 +03:00
var LabelOverlay = AbstractIconOverlay.extend({
initialize: function(wsChannel, layerMgr) {
2019-02-08 20:06:16 +03:00
AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "label");
2019-02-08 17:12:40 +03:00
},
getIcon: function(lbl){
2019-02-26 23:19:01 +03:00
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>"
});
2019-02-08 17:12:40 +03:00
},
createPopup: function(lbl){
2019-02-26 23:19:01 +03:00
return "<p>" + lbl.attributes.text + "</p>";
2019-02-08 17:12:40 +03:00
}
});