Fix: shift+click preserves input value, Ctrl+click adopts value, stable highlight layout
- shift+click now only sets fromUnitId; inputValue is unchanged so all outputs recalculate correctly from the original user input - Ctrl+click is a new gesture that sets both fromUnitId and inputValue to the tile's displayed converted value (the "pivot" action) - highlighted-result block always renders with min-height:8rem so the page below it never jumps when a highlight is added or cleared - hotkey hint updated to document all three click gestures Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import type { Unit, ResultItem } from '$lib/types';
|
||||
import type { Big } from 'big.js';
|
||||
import { MIN_COLUMN_WIDTH, GRID_GAP } from '$lib/config';
|
||||
import UnitInput from './UnitInput.svelte';
|
||||
import UnitDropdown from './UnitDropdown.svelte';
|
||||
@@ -19,7 +20,8 @@
|
||||
oninputchange,
|
||||
onunitchange,
|
||||
onhighlight,
|
||||
onsetinput
|
||||
onsetinput,
|
||||
onctrlclick
|
||||
}: {
|
||||
units: Unit[];
|
||||
inputValue: number;
|
||||
@@ -30,6 +32,7 @@
|
||||
onunitchange: (id: string) => void;
|
||||
onhighlight: (id: string) => void;
|
||||
onsetinput: (id: string) => void;
|
||||
onctrlclick: (id: string, value: Big) => void;
|
||||
} = $props();
|
||||
|
||||
const gridStyle = `--min-col-width: ${MIN_COLUMN_WIDTH}; --grid-gap: ${GRID_GAP};`;
|
||||
@@ -50,11 +53,12 @@
|
||||
isInputUnit={item.unit.id === fromUnitId}
|
||||
onclick={() => onhighlight(item.unit.id)}
|
||||
onshiftclick={() => onsetinput(item.unit.id)}
|
||||
onctrlclick={() => onctrlclick(item.unit.id, item.convertedValue)}
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<p class="hotkey-hint">
|
||||
<small>Click a result to highlight it · Shift+click to use it as input</small>
|
||||
<small>Click to highlight · Shift+click to change input unit · Ctrl+click to adopt value as input</small>
|
||||
</p>
|
||||
</article>
|
||||
|
||||
Reference in New Issue
Block a user