Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import { Button, Input, modalManager, toastManager } from '@immich/ui';
import { Canvas, InteractiveFabricObject, Rect } from 'fabric';
import { clamp } from 'lodash-es';
import { onMount } from 'svelte';
import { onMount, tick } from 'svelte';
import { t } from 'svelte-i18n';

interface Props {
Expand All @@ -27,6 +27,7 @@
let faceRect: Rect | undefined = $state();
let faceSelectorEl: HTMLDivElement | undefined = $state();
let scrollableListEl: HTMLDivElement | undefined = $state();
let searchInputEl: HTMLInputElement | null = $state(null);
let page = $state(1);
let candidates = $state<PersonResponseDto[]>([]);

Expand Down Expand Up @@ -81,6 +82,8 @@
onMount(async () => {
setupCanvas();
await getPeople();
await tick();
searchInputEl?.focus();
});

const imageContentMetrics = $derived.by(() => {
Expand Down Expand Up @@ -221,12 +224,15 @@

$effect(() => {
const rect = faceRect;
if (rect) {
const cvs = canvas;
if (rect && cvs) {
rect.on('moving', positionFaceSelector);
rect.on('scaling', positionFaceSelector);
cvs.on('object:modified', () => searchInputEl?.focus());
return () => {
rect.off('moving', positionFaceSelector);
rect.off('scaling', positionFaceSelector);
cvs.off('object:modified', () => searchInputEl?.focus());
};
}
});
Expand Down Expand Up @@ -290,7 +296,7 @@
};
</script>

<svelte:document use:shortcut={{ shortcut: { key: 'Escape' }, onShortcut: cancel }} />
<svelte:document use:shortcut={{ shortcut: { key: 'Escape' }, onShortcut: cancel, ignoreInputFields: false }} />

<div
id="face-editor-data"
Expand All @@ -310,7 +316,7 @@
<p class="text-center text-sm">{$t('select_person_to_tag')}</p>

<div class="my-3 relative">
<Input placeholder={$t('search_people')} bind:value={searchTerm} size="tiny" />
<Input placeholder={$t('search_people')} bind:value={searchTerm} bind:ref={searchInputEl} size="tiny" />
</div>

<div bind:this={scrollableListEl} class="h-62.5 overflow-y-auto mt-2">
Expand Down
Loading