Skip to content

Commit

Permalink
hide buttons for resetting if disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
duranb committed Sep 4, 2024
1 parent 03e752a commit 7aef78b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/components/parameters/ParameterInfo.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import ValueSourceBadge from './ValueSourceBadge.svelte';
export let formParameter: FormParameter;
export let disabled: boolean = false;
const dispatch = createEventDispatcher<{
reset: FormParameter;
Expand Down Expand Up @@ -87,7 +88,9 @@
{/if}
{#if source !== 'none'}
<div class="parameter-info-label">Source</div>
<div class="parameter-info-value"><ValueSourceBadge isCompact={false} {source} on:reset={onReset} /></div>
<div class="parameter-info-value">
<ValueSourceBadge {disabled} isCompact={false} {source} on:reset={onReset} />
</div>
{/if}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/parameters/Parameters.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
/>
{/if}
<div class="parameter-info">
<ParameterInfo {formParameter} on:reset />
<ParameterInfo {disabled} {formParameter} on:reset />
</div>
</div>
</Highlight>
Expand Down
6 changes: 3 additions & 3 deletions src/components/parameters/ValueSourceBadge.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
case 'user on model':
case 'user on preset':
showButton = true;
tooltipContent = 'Modified';
tooltipShortcut = `${isMacOs() ? '' : 'CTRL'} Click`;
tooltipShortcutLabel = `Reset to ${source === 'user on preset' ? presetText : 'Model'}`;
tooltipContent = 'Modified';
break;
case 'preset':
tooltipContent = `${presetText} Value`;
Expand Down Expand Up @@ -86,8 +86,8 @@
content: tooltipContent,
disabled: !isCompact,
placement: 'top',
shortcut: tooltipShortcut,
shortcutLabel: tooltipShortcutLabel,
shortcut: !disabled ? tooltipShortcut : '',
shortcutLabel: !disabled ? tooltipShortcutLabel : '',
}}
use:useActions={use}
on:click={onClick}
Expand Down

0 comments on commit 7aef78b

Please sign in to comment.