optional auto update

This commit is contained in:
waltem01 2024-02-21 09:55:19 +01:00
parent c38f300796
commit 3e2ef80ad3

View File

@ -20,6 +20,7 @@
y: number; y: number;
w: number; w: number;
h: number; h: number;
u: boolean;
} }
let imageURL: string | null; let imageURL: string | null;
@ -109,7 +110,8 @@
x: parseInt(fdata.get('x')?.toString() ?? '0'), x: parseInt(fdata.get('x')?.toString() ?? '0'),
y: parseInt(fdata.get('y')?.toString() ?? '0'), y: parseInt(fdata.get('y')?.toString() ?? '0'),
w: parseInt(fdata.get('w')?.toString() ?? matrix.width.toString()), w: parseInt(fdata.get('w')?.toString() ?? matrix.width.toString()),
h: parseInt(fdata.get('h')?.toString() ?? matrix.height.toString()) h: parseInt(fdata.get('h')?.toString() ?? matrix.height.toString()),
u: fdata.get('update') ? true : false
}; };
// Time upload by saving date // Time upload by saving date
@ -211,6 +213,14 @@
/> />
</div> </div>
<div class="grid grid-cols-2">
<label class="border-2 border-black border-r-0 border-b-0 pl-1" for="update">Auto update:</label
>
<div class="border-2 border-black border-b-0 pl-1 bg-gray-100 w-full">
<input class="w-full" type="checkbox" name="update" id="update" checked />
</div>
</div>
<input <input
class="border-2 border-black hover:bg-gray-200 cursor-pointer" class="border-2 border-black hover:bg-gray-200 cursor-pointer"
type="submit" type="submit"
@ -234,13 +244,23 @@
<p>Placing image . . .</p> <p>Placing image . . .</p>
<p>{uploadData.elapsed} seconds elapsed.</p> <p>{uploadData.elapsed} seconds elapsed.</p>
{:then} {:then}
{#await updateMatrix()} {#if submitData.u}
<p>Updating matrix . . .</p> {#await updateMatrix()}
<p>{uploadData.elapsed} seconds elapsed.</p> <p>Updating matrix . . .</p>
{:then} <p>{uploadData.elapsed} seconds elapsed.</p>
{:then}
<p>Done!</p>
<p>{uploadData.elapsed} seconds elapsed.</p>
{/await}
{:else}
<p>Done!</p> <p>Done!</p>
<p>{uploadData.elapsed} seconds elapsed.</p> <p>
{/await} {(() => {
clearInterval(uploadData.interval);
return uploadData.elapsed;
})()} seconds elapsed.
</p>
{/if}
{/await} {/await}
{/await} {/await}
{/await} {/await}