diff --git a/assets/layers/last_click/last_click.json b/assets/layers/last_click/last_click.json index 4b5ff01c1..b9cb5311b 100644 --- a/assets/layers/last_click/last_click.json +++ b/assets/layers/last_click/last_click.json @@ -4,19 +4,34 @@ "description": "This 'layer' is not really a layer, but contains part of the code how the popup to 'add a new marker' is displayed", "source": "special", "isShown": { - "or": [ + "and": [ { - "and": [ - "mouse_button=right", - "_usermode=button_click_right" + "or": [ + "has_note_layer=yes", + { + "and": [ + "has_presets=yes", + "_addNewEnabled=yes" + ] + } ] }, - "_usermode=button_click", - "_usermode=click", { - "and": [ - "mouse_button=right", - "_usermode=click_right" + "or": [ + { + "and": [ + "mouse_button=right", + "_usermode=button_click_right" + ] + }, + "_usermode=button_click", + "_usermode=click", + { + "and": [ + "mouse_button=right", + "_usermode=click_right" + ] + } ] } ] @@ -118,7 +133,7 @@ "if": { "and": [ "has_note_layer=yes", - "has_presets=yesno" + "has_presets=no" ] }, "then": { @@ -168,7 +183,7 @@ "tagRenderings": [ { "id": "add_new", - "classes": "h-full flex", + "classes": "h-full flex special-add-new-point", "condition": "has_presets=yes", "render": { "*": "{add_new_point()}" diff --git a/src/Logic/FeatureSource/Sources/LastClickFeatureSource.ts b/src/Logic/FeatureSource/Sources/LastClickFeatureSource.ts index 739b0435b..2366785cb 100644 --- a/src/Logic/FeatureSource/Sources/LastClickFeatureSource.ts +++ b/src/Logic/FeatureSource/Sources/LastClickFeatureSource.ts @@ -19,12 +19,15 @@ export class LastClickFeatureSource implements FeatureSource { public static readonly newPointElementId = "new_point_dialog" public readonly features: Store private _usermode: UIEventSource + private _enabledAddMorePoints: UIEventSource constructor( layout: LayoutConfig, clickSource: Store<{ lon: number; lat: number; mode: "left" | "right" | "middle" }>, - usermode?: UIEventSource + usermode?: UIEventSource, + enabledAddMorePoints?: UIEventSource ) { this._usermode = usermode + this._enabledAddMorePoints = enabledAddMorePoints this.hasNoteLayer = layout.hasNoteLayer() this.hasPresets = layout.hasPresets() const allPresets: BaseUIElement[] = [] @@ -68,7 +71,8 @@ export class LastClickFeatureSource implements FeatureSource { number_of_presets: "" + this.renderings.length, first_preset: this.renderings[0], mouse_button: mode ?? "none", - _usermode: this._usermode?.data + _usermode: this._usermode?.data, + _addNewEnabled: (this._enabledAddMorePoints?.data ?? true) ? "yes" : "no" } this.i++ diff --git a/src/UI/Popup/TagRendering/TagRenderingAnswer.svelte b/src/UI/Popup/TagRendering/TagRenderingAnswer.svelte index bbe8c52bb..1b5401a50 100644 --- a/src/UI/Popup/TagRendering/TagRenderingAnswer.svelte +++ b/src/UI/Popup/TagRendering/TagRenderingAnswer.svelte @@ -28,7 +28,7 @@ {#if config !== undefined && (config?.condition === undefined || config.condition.matchesProperties($tags))} -