UX: show full screen, hide addNew-marker if there are no presets

This commit is contained in:
Pieter Vander Vennet 2024-06-21 12:21:49 +02:00
parent 1acb645beb
commit d60a467455
3 changed files with 33 additions and 14 deletions

View file

@ -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", "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", "source": "special",
"isShown": { "isShown": {
"or": [ "and": [
{ {
"and": [ "or": [
"mouse_button=right", "has_note_layer=yes",
"_usermode=button_click_right" {
"and": [
"has_presets=yes",
"_addNewEnabled=yes"
]
}
] ]
}, },
"_usermode=button_click",
"_usermode=click",
{ {
"and": [ "or": [
"mouse_button=right", {
"_usermode=click_right" "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": { "if": {
"and": [ "and": [
"has_note_layer=yes", "has_note_layer=yes",
"has_presets=yesno" "has_presets=no"
] ]
}, },
"then": { "then": {
@ -168,7 +183,7 @@
"tagRenderings": [ "tagRenderings": [
{ {
"id": "add_new", "id": "add_new",
"classes": "h-full flex", "classes": "h-full flex special-add-new-point",
"condition": "has_presets=yes", "condition": "has_presets=yes",
"render": { "render": {
"*": "{add_new_point()}" "*": "{add_new_point()}"

View file

@ -19,12 +19,15 @@ export class LastClickFeatureSource implements FeatureSource {
public static readonly newPointElementId = "new_point_dialog" public static readonly newPointElementId = "new_point_dialog"
public readonly features: Store<Feature[]> public readonly features: Store<Feature[]>
private _usermode: UIEventSource<string> private _usermode: UIEventSource<string>
private _enabledAddMorePoints: UIEventSource<boolean>
constructor( constructor(
layout: LayoutConfig, layout: LayoutConfig,
clickSource: Store<{ lon: number; lat: number; mode: "left" | "right" | "middle" }>, clickSource: Store<{ lon: number; lat: number; mode: "left" | "right" | "middle" }>,
usermode?: UIEventSource<string> usermode?: UIEventSource<string>,
enabledAddMorePoints?: UIEventSource<boolean>
) { ) {
this._usermode = usermode this._usermode = usermode
this._enabledAddMorePoints = enabledAddMorePoints
this.hasNoteLayer = layout.hasNoteLayer() this.hasNoteLayer = layout.hasNoteLayer()
this.hasPresets = layout.hasPresets() this.hasPresets = layout.hasPresets()
const allPresets: BaseUIElement[] = [] const allPresets: BaseUIElement[] = []
@ -68,7 +71,8 @@ export class LastClickFeatureSource implements FeatureSource {
number_of_presets: "" + this.renderings.length, number_of_presets: "" + this.renderings.length,
first_preset: this.renderings[0], first_preset: this.renderings[0],
mouse_button: mode ?? "none", mouse_button: mode ?? "none",
_usermode: this._usermode?.data _usermode: this._usermode?.data,
_addNewEnabled: (this._enabledAddMorePoints?.data ?? true) ? "yes" : "no"
} }
this.i++ this.i++

View file

@ -28,7 +28,7 @@
</script> </script>
{#if config !== undefined && (config?.condition === undefined || config.condition.matchesProperties($tags))} {#if config !== undefined && (config?.condition === undefined || config.condition.matchesProperties($tags))}
<div {id} class={twMerge("link-underline flex w-full flex-col", extraClasses)}> <div {id} class={twMerge("link-underline flex w-full h-full flex-col", extraClasses)}>
{#if $trs.length === 1} {#if $trs.length === 1}
<TagRenderingMapping <TagRenderingMapping
mapping={$trs[0]} mapping={$trs[0]}