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",
"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()}"

View file

@ -19,12 +19,15 @@ export class LastClickFeatureSource implements FeatureSource {
public static readonly newPointElementId = "new_point_dialog"
public readonly features: Store<Feature[]>
private _usermode: UIEventSource<string>
private _enabledAddMorePoints: UIEventSource<boolean>
constructor(
layout: LayoutConfig,
clickSource: Store<{ lon: number; lat: number; mode: "left" | "right" | "middle" }>,
usermode?: UIEventSource<string>
usermode?: UIEventSource<string>,
enabledAddMorePoints?: UIEventSource<boolean>
) {
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++

View file

@ -28,7 +28,7 @@
</script>
{#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}
<TagRenderingMapping
mapping={$trs[0]}