Add check to new points as not to add points for disabled layers

This commit is contained in:
Pieter Vander Vennet 2020-09-17 21:10:35 +02:00
parent f544ca805a
commit 16394bb08f
2 changed files with 16 additions and 0 deletions

View file

@ -46,6 +46,9 @@ export class SimpleAddUI extends UIElement {
const self = this;
for (const layer of State.state.filteredLayers.data) {
this.ListenTo(layer.isDisplayed);
for (const preset of layer.layerDef.presets) {
let icon: string = "./assets/bug.svg";
@ -130,6 +133,15 @@ export class SimpleAddUI extends UIElement {
const userDetails = State.state.osmConnection.userDetails;
if (this._confirmPreset.data !== undefined) {
if(!this._confirmPreset.data.layerToAddTo.isDisplayed.data){
return new Combine([
Translations.t.general.add.layerNotEnabled.Subs({layer: this._confirmPreset.data.layerToAddTo.layerDef.name})
.SetClass("alert"),
this.cancelButton
]).Render();
}
let tagInfo = "";
const csCount = State.state.osmConnection.userDetails.data.csCount;

View file

@ -379,6 +379,10 @@ export default class Translations {
fr: "Ajouter un/une {category} ici",
gl: "Engadir {category} aquí",
de: "Hier eine {category} hinzufügen"
}),
layerNotEnabled: new T({
"en":"The layer {layer} is not enabled. Enable this layer to add a point",
"nl":"De laag {layer} is gedeactiveerd. Activeer deze om een punt toe te voegn"
})
},
pickLanguage: new T({