on main help sign in
redefine X button behavior in sigil input tool
f385d34John Hyde
desk/doc/usr/astrolabe.udon+2−1
@@ -36,7 +36,8 @@ Select component catogeries on the right, and then tap the options on the sigil
36to add them to your search.
36to add them to your search.
37
37
38The ^ button goes up a level so you can select another category.
38The ^ button goes up a level so you can select another category.
39−The X button will clear sigil components based on what type you're inputting.
39+The X button will clear sigil components from the current symbol,
40+except the basic shape. If only the basic shape remains, the X button will clear that.
40At the top level, the X button will clear all inputs.
41At the top level, the X button will clear all inputs.
41
42
42Your contacts will be searched for any search.
43Your contacts will be searched for any search.
ui/src/components/search/sigil/SymbolInputModeSelector.svelte+6−3
@@ -98,10 +98,13 @@
98 }
98 }
99
99
100 function clear() {
100 function clear() {
101− if (modes.length) {
101+ // If a geon is present it should be preserved, unless it's the only component
102− symbolQuery = symbolQuery.clearPartType(modes[0] as PartType);
102+ // If there's only 1 component, it should be removed
103− } else {
103+ // Otherwise, at least one component might be a geon and should be preserved
104+ if (symbolQuery.components.length === 1) {
104 symbolQuery = symbolQuery.clear();
105 symbolQuery = symbolQuery.clear();
106+ } else {
107+ symbolQuery = symbolQuery.clearExceptPartType('geon');
105 }
108 }
106 }
109 }
107</script>
110</script>
ui/src/components/search/sigil/SymbolInputNavButtons.svelte+8−3
@@ -4,6 +4,11 @@
4
4
5 export let onDone: () => void = null;
5 export let onDone: () => void = null;
6 export let onClear: () => void = null;
6 export let onClear: () => void = null;
7+ export let hideDoneButton = false;
8+ export let hideClearButton = false;
9+
10+ $: showDoneButton = (onDone && !hideDoneButton);
11+ $: showClearButton = (onClear && !hideClearButton);
7
12
8 let buttonClasses = 'cursor-pointer border border-gray-500 rounded-md aspect-square w-[48px]';
13 let buttonClasses = 'cursor-pointer border border-gray-500 rounded-md aspect-square w-[48px]';
9</script>
14</script>
@@ -14,11 +19,11 @@
14 }
19 }
15</style>
20</style>
16
21
17−<div class="grid gap-1 self-start justify-center mr-1 xs:mr-0 xs:mb-1 xs:self-stretch {(onDone && onClear) ? 'grid-cols-custom' : ''}">
22+<div class="grid gap-1 self-start justify-center mr-1 xs:mr-0 xs:mb-1 xs:self-stretch {(showDoneButton && showClearButton) ? 'grid-cols-custom' : ''}">
18− {#if onDone}
23+ {#if showDoneButton}
19 <img src={upArrow} alt="done" class={buttonClasses} on:click={onDone}/>
24 <img src={upArrow} alt="done" class={buttonClasses} on:click={onDone}/>
20 {/if}
25 {/if}
21− {#if onClear}
26+ {#if showClearButton}
22 <img src={xIcon} alt="clear" class={buttonClasses} on:click={onClear}/>
27 <img src={xIcon} alt="clear" class={buttonClasses} on:click={onClear}/>
23 {/if}
28 {/if}
24 </div>
29 </div>
ui/src/lib/sigil.ts+5
@@ -343,6 +343,11 @@ export class SymbolQuery {
343 return this;
343 return this;
344 }
344 }
345
345
346+ clearExceptPartType(partType: PartType) {
347+ this.components = this.components.filter(c => c[0] === partType[0]);
348+ return this;
349+ }
350+
346 clear() {
351 clear() {
347 this.components = [];
352 this.components = [];
348 return this;
353 return this;