place image onto canvas

This commit is contained in:
waltem01 2024-02-16 07:22:37 +01:00
parent c9507ed683
commit 6a2e1f48f9

View File

@ -10,6 +10,13 @@
let imageURL: string | null, lastImage: File; let imageURL: string | null, lastImage: File;
let uploadData: UploadData; let uploadData: UploadData;
async function placeImage() {
const fdata = new FormData();
fdata.append('x', '0');
fdata.append('y', '0');
await post(fdata, 'image');
}
async function sendImage(url: string) { async function sendImage(url: string) {
const fdata = new FormData(); const fdata = new FormData();
fdata.append('url', url); fdata.append('url', url);
@ -97,9 +104,14 @@
{#await sendImage(dataUrl)} {#await sendImage(dataUrl)}
<p>Sending image . . .</p> <p>Sending image . . .</p>
<p>{uploadData.elapsed} seconds elapsed.</p> <p>{uploadData.elapsed} seconds elapsed.</p>
{:then}
{#await placeImage()}
<p>Placing image . . .</p>
<p>{uploadData.elapsed} seconds elapsed.</p>
{:then} {:then}
<p>Done!</p> <p>Done!</p>
<p>{uploadData.elapsed} seconds elapsed.</p> <p>{uploadData.elapsed} seconds elapsed.</p>
{/await} {/await}
{/await} {/await}
{/await}
{/if} {/if}