parent
fbb7125167
commit
cfbe5c0b88
3 changed files with 15 additions and 7 deletions
|
@ -60,6 +60,8 @@ COMMIT;
|
|||
el (Greek), gl (Galician)
|
||||
- JS locales are now bundled, no need to generate them while installing
|
||||
- local settings are now loaded from `/etc/umap/umap.conf` if available
|
||||
- fixed an issue where it was not possible to change the tilelayer if the
|
||||
tilelayer control was not added to the map (#587)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -729,10 +729,16 @@ L.U.Map.include({
|
|||
|
||||
|
||||
L.U.TileLayerControl = L.Control.extend({
|
||||
|
||||
options: {
|
||||
position: 'topleft'
|
||||
},
|
||||
|
||||
initialize: function (map, options) {
|
||||
this.map = map;
|
||||
L.Control.prototype.initialize.call(this, options);
|
||||
},
|
||||
|
||||
onAdd: function () {
|
||||
var container = L.DomUtil.create('div', 'leaflet-control-tilelayers umap-control');
|
||||
|
||||
|
@ -754,22 +760,22 @@ L.U.TileLayerControl = L.Control.extend({
|
|||
},
|
||||
|
||||
buildList: function (options) {
|
||||
this._map.eachTileLayer(function (tilelayer) {
|
||||
this.map.eachTileLayer(function (tilelayer) {
|
||||
this.addTileLayerElement(tilelayer, options);
|
||||
}, this);
|
||||
this._map.ui.openPanel({data: {html: this._tilelayers_container}, className: options.className});
|
||||
this.map.ui.openPanel({data: {html: this._tilelayers_container}, className: options.className});
|
||||
},
|
||||
|
||||
addTileLayerElement: function (tilelayer, options) {
|
||||
var selectedClass = this._map.hasLayer(tilelayer) ? 'selected' : '',
|
||||
var selectedClass = this.map.hasLayer(tilelayer) ? 'selected' : '',
|
||||
el = L.DomUtil.create('li', selectedClass, this._tilelayers_container),
|
||||
img = L.DomUtil.create('img', '', el),
|
||||
name = L.DomUtil.create('div', '', el);
|
||||
img.src = L.Util.template(tilelayer.options.url_template, this._map.demoTileInfos);
|
||||
img.src = L.Util.template(tilelayer.options.url_template, this.map.demoTileInfos);
|
||||
name.innerHTML = tilelayer.options.name;
|
||||
L.DomEvent.on(el, 'click', function () {
|
||||
this._map.selectTileLayer(tilelayer);
|
||||
this._map.ui.closePanel();
|
||||
this.map.selectTileLayer(tilelayer);
|
||||
this.map.ui.closePanel();
|
||||
if (options && options.callback) options.callback(tilelayer);
|
||||
}, this);
|
||||
}
|
||||
|
|
|
@ -247,7 +247,7 @@ L.U.Map.include({
|
|||
this._controls.fullscreen = new L.Control.Fullscreen({title: {'false': L._('View Fullscreen'), 'true': L._('Exit Fullscreen')}});
|
||||
this._controls.search = new L.U.SearchControl();
|
||||
this._controls.embed = new L.Control.Embed(this, this.options.embedOptions);
|
||||
this._controls.tilelayers = new L.U.TileLayerControl();
|
||||
this._controls.tilelayers = new L.U.TileLayerControl(this);
|
||||
this._controls.editinosm = new L.Control.EditInOSM({
|
||||
position: 'topleft',
|
||||
widgetOptions: {helpText: L._('Open this map extent in a map editor to provide more accurate data to OpenStreetMap')}
|
||||
|
|
Loading…
Reference in a new issue