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; const self = this;
for (const layer of State.state.filteredLayers.data) { for (const layer of State.state.filteredLayers.data) {
this.ListenTo(layer.isDisplayed);
for (const preset of layer.layerDef.presets) { for (const preset of layer.layerDef.presets) {
let icon: string = "./assets/bug.svg"; let icon: string = "./assets/bug.svg";
@ -131,6 +134,15 @@ export class SimpleAddUI extends UIElement {
if (this._confirmPreset.data !== undefined) { 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 = ""; let tagInfo = "";
const csCount = State.state.osmConnection.userDetails.data.csCount; const csCount = State.state.osmConnection.userDetails.data.csCount;
if (csCount > State.userJourney.tagsVisibleAt) { if (csCount > State.userJourney.tagsVisibleAt) {

View file

@ -379,6 +379,10 @@ export default class Translations {
fr: "Ajouter un/une {category} ici", fr: "Ajouter un/une {category} ici",
gl: "Engadir {category} aquí", gl: "Engadir {category} aquí",
de: "Hier eine {category} hinzufügen" 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({ pickLanguage: new T({