Spaces:
Runtime error
Runtime error
minor UI
Browse files- frontend/src/lib/App.svelte +1 -4
- frontend/src/lib/Buttons/DragButton.svelte +2 -1
- frontend/src/lib/Buttons/MaskButton.svelte +3 -1
- frontend/src/lib/Buttons/PPButton.svelte +3 -3
- frontend/src/lib/Buttons/UndoButton.svelte +4 -1
- frontend/src/lib/Icons/Mask.svelte +2 -2
- frontend/src/lib/Icons/Move.svelte +2 -2
- frontend/src/lib/PaintFrame.svelte +16 -6
- frontend/src/lib/PromptModal.svelte +2 -1
frontend/src/lib/App.svelte
CHANGED
@@ -41,11 +41,8 @@
|
|
41 |
|
42 |
$: isLoading = $myPresence?.status === Status.loading || false;
|
43 |
|
44 |
-
$: {
|
45 |
-
console.log($myPresence.status);
|
46 |
-
}
|
47 |
function onPrompt() {
|
48 |
-
if (!isLoading) {
|
49 |
showModal = true;
|
50 |
myPresence.update({
|
51 |
status: Status.prompting
|
|
|
41 |
|
42 |
$: isLoading = $myPresence?.status === Status.loading || false;
|
43 |
|
|
|
|
|
|
|
44 |
function onPrompt() {
|
45 |
+
if (!isLoading && !showModal) {
|
46 |
showModal = true;
|
47 |
myPresence.update({
|
48 |
status: Status.prompting
|
frontend/src/lib/Buttons/DragButton.svelte
CHANGED
@@ -2,12 +2,13 @@
|
|
2 |
import Move from '$lib/Icons/Move.svelte';
|
3 |
export let isActive = false;
|
4 |
export let isLoading = false;
|
|
|
5 |
</script>
|
6 |
|
7 |
<button
|
8 |
on:click
|
9 |
disabled={isLoading}
|
10 |
-
class="bg-white rounded-full
|
11 |
title="Enable Dragging"
|
12 |
>
|
13 |
<Move />
|
|
|
2 |
import Move from '$lib/Icons/Move.svelte';
|
3 |
export let isActive = false;
|
4 |
export let isLoading = false;
|
5 |
+
export let className = '';
|
6 |
</script>
|
7 |
|
8 |
<button
|
9 |
on:click
|
10 |
disabled={isLoading}
|
11 |
+
class="{className} shadow-lg bg-white rounded-full {isActive ? 'text-blue-700' : 'text-gray-800'}"
|
12 |
title="Enable Dragging"
|
13 |
>
|
14 |
<Move />
|
frontend/src/lib/Buttons/MaskButton.svelte
CHANGED
@@ -2,12 +2,14 @@
|
|
2 |
import Mask from '$lib/Icons/Mask.svelte';
|
3 |
export let isActive = false;
|
4 |
export let isLoading = false;
|
|
|
|
|
5 |
</script>
|
6 |
|
7 |
<button
|
8 |
on:click
|
9 |
disabled={isLoading}
|
10 |
-
class="
|
11 |
title="Enable Masking"
|
12 |
>
|
13 |
<Mask />
|
|
|
2 |
import Mask from '$lib/Icons/Mask.svelte';
|
3 |
export let isActive = false;
|
4 |
export let isLoading = false;
|
5 |
+
export let className = '';
|
6 |
+
|
7 |
</script>
|
8 |
|
9 |
<button
|
10 |
on:click
|
11 |
disabled={isLoading}
|
12 |
+
class="{className} rounded-full {isActive ? 'text-blue-700' : 'text-gray-800'}"
|
13 |
title="Enable Masking"
|
14 |
>
|
15 |
<Mask />
|
frontend/src/lib/Buttons/PPButton.svelte
CHANGED
@@ -5,11 +5,11 @@
|
|
5 |
<button
|
6 |
on:click
|
7 |
disabled={isLoading}
|
8 |
-
class="button-paint
|
9 |
title="New Paint Frame"
|
10 |
>
|
11 |
{#if isLoading}
|
12 |
-
<span
|
13 |
<span
|
14 |
class="rounded-sm h-6 w-6 flex justify-center items-center border-2 border-dashed border-violet-700 mr-2"
|
15 |
>
|
@@ -24,6 +24,6 @@
|
|
24 |
@apply disabled:opacity-50 dark:bg-white dark:text-black bg-black text-white rounded-2xl text-xs shadow-sm focus:outline-none focus:border-gray-400;
|
25 |
} */
|
26 |
.button-paint {
|
27 |
-
@apply font-mono flex justify-center items-center disabled:opacity-80 dark:bg-white dark:text-black rounded-2xl px-3 py-1 shadow-sm focus:outline-none focus:border-gray-400;
|
28 |
}
|
29 |
</style>
|
|
|
5 |
<button
|
6 |
on:click
|
7 |
disabled={isLoading}
|
8 |
+
class="button-paint"
|
9 |
title="New Paint Frame"
|
10 |
>
|
11 |
{#if isLoading}
|
12 |
+
<span>paiting... </span>{:else}
|
13 |
<span
|
14 |
class="rounded-sm h-6 w-6 flex justify-center items-center border-2 border-dashed border-violet-700 mr-2"
|
15 |
>
|
|
|
24 |
@apply disabled:opacity-50 dark:bg-white dark:text-black bg-black text-white rounded-2xl text-xs shadow-sm focus:outline-none focus:border-gray-400;
|
25 |
} */
|
26 |
.button-paint {
|
27 |
+
@apply text-lg font-mono bg-violet-100 text-violet-900 min-w-[25ch] flex justify-center items-center disabled:opacity-80 dark:bg-white dark:text-black rounded-2xl px-3 py-1 shadow-sm focus:outline-none focus:border-gray-400;
|
28 |
}
|
29 |
</style>
|
frontend/src/lib/Buttons/UndoButton.svelte
CHANGED
@@ -2,12 +2,15 @@
|
|
2 |
import Undo from '$lib/Icons/Undo.svelte';
|
3 |
export let isActive = false;
|
4 |
export let isLoading = false;
|
|
|
5 |
</script>
|
6 |
|
7 |
<button
|
8 |
on:click
|
9 |
disabled={isLoading}
|
10 |
-
class="bg-white rounded-full
|
|
|
|
|
11 |
title="Clear Masking"
|
12 |
>
|
13 |
<Undo />
|
|
|
2 |
import Undo from '$lib/Icons/Undo.svelte';
|
3 |
export let isActive = false;
|
4 |
export let isLoading = false;
|
5 |
+
export let className = '';
|
6 |
</script>
|
7 |
|
8 |
<button
|
9 |
on:click
|
10 |
disabled={isLoading}
|
11 |
+
class="{className} bg-white rounded-full bg-white rounded-full {isActive
|
12 |
+
? 'text-blue-700'
|
13 |
+
: 'text-gray-800'}"
|
14 |
title="Clear Masking"
|
15 |
>
|
16 |
<Undo />
|
frontend/src/lib/Icons/Mask.svelte
CHANGED
@@ -4,8 +4,8 @@
|
|
4 |
|
5 |
<svg
|
6 |
class={classList}
|
7 |
-
width="
|
8 |
-
height="
|
9 |
viewBox="0 0 11 11"
|
10 |
fill="none"
|
11 |
xmlns="http://www.w3.org/2000/svg"
|
|
|
4 |
|
5 |
<svg
|
6 |
class={classList}
|
7 |
+
width="50"
|
8 |
+
height="50"
|
9 |
viewBox="0 0 11 11"
|
10 |
fill="none"
|
11 |
xmlns="http://www.w3.org/2000/svg"
|
frontend/src/lib/Icons/Move.svelte
CHANGED
@@ -4,8 +4,8 @@
|
|
4 |
|
5 |
<svg
|
6 |
class={classList}
|
7 |
-
width="
|
8 |
-
height="
|
9 |
viewBox="0 0 11 11"
|
10 |
fill="none"
|
11 |
xmlns="http://www.w3.org/2000/svg"
|
|
|
4 |
|
5 |
<svg
|
6 |
class={classList}
|
7 |
+
width="50"
|
8 |
+
height="50"
|
9 |
viewBox="0 0 11 11"
|
10 |
fill="none"
|
11 |
xmlns="http://www.w3.org/2000/svg"
|
frontend/src/lib/PaintFrame.svelte
CHANGED
@@ -36,6 +36,11 @@
|
|
36 |
$: isLoading =
|
37 |
$myPresence?.status === Status.loading || $myPresence?.status === Status.prompting || false;
|
38 |
|
|
|
|
|
|
|
|
|
|
|
39 |
$: coord = {
|
40 |
x: transform.applyX(position.x),
|
41 |
y: transform.applyY(position.y)
|
@@ -207,18 +212,23 @@
|
|
207 |
{/if}
|
208 |
{#if !isDragging}
|
209 |
<div class="absolute top-full ">
|
210 |
-
<div class="py-
|
211 |
<PPButton {isLoading} on:click={() => dispatch('prompt')} />
|
212 |
</div>
|
213 |
</div>
|
214 |
<div class="absolute left-full bottom-0">
|
215 |
-
<div class="
|
216 |
-
<DragButton
|
217 |
-
|
218 |
-
|
|
|
|
|
|
|
|
|
|
|
219 |
{#if !dragEnabled}
|
220 |
<span class="border-gray-800 border-opacity-50 border-r-2 my-2" />
|
221 |
-
<UndoButton {isLoading} on:click={cleanMask} />
|
222 |
{/if}
|
223 |
</div>
|
224 |
</div>
|
|
|
36 |
$: isLoading =
|
37 |
$myPresence?.status === Status.loading || $myPresence?.status === Status.prompting || false;
|
38 |
|
39 |
+
$: {
|
40 |
+
if (!dragEnabled && $myPresence.status === Status.loading) {
|
41 |
+
dragEnabled = true;
|
42 |
+
}
|
43 |
+
}
|
44 |
$: coord = {
|
45 |
x: transform.applyX(position.x),
|
46 |
y: transform.applyY(position.y)
|
|
|
212 |
{/if}
|
213 |
{#if !isDragging}
|
214 |
<div class="absolute top-full ">
|
215 |
+
<div class="py-3">
|
216 |
<PPButton {isLoading} on:click={() => dispatch('prompt')} />
|
217 |
</div>
|
218 |
</div>
|
219 |
<div class="absolute left-full bottom-0">
|
220 |
+
<div class="mx-4">
|
221 |
+
<DragButton
|
222 |
+
className={'p-1'}
|
223 |
+
{isLoading}
|
224 |
+
isActive={dragEnabled}
|
225 |
+
on:click={toggleDrag}
|
226 |
+
/>
|
227 |
+
<div class="flex bg-white rounded-full mt-3 shadow-lg">
|
228 |
+
<MaskButton className={'p-1'} isActive={!dragEnabled} on:click={toggleDrawMask} />
|
229 |
{#if !dragEnabled}
|
230 |
<span class="border-gray-800 border-opacity-50 border-r-2 my-2" />
|
231 |
+
<UndoButton className={'p-1 px-4'} {isLoading} on:click={cleanMask} />
|
232 |
{/if}
|
233 |
</div>
|
234 |
</div>
|
frontend/src/lib/PromptModal.svelte
CHANGED
@@ -15,10 +15,12 @@
|
|
15 |
};
|
16 |
onMount(() => {
|
17 |
inputEl.focus();
|
|
|
18 |
prompt = '';
|
19 |
window.addEventListener('keyup', onKeyup);
|
20 |
return () => {
|
21 |
window.removeEventListener('keyup', onKeyup);
|
|
|
22 |
};
|
23 |
});
|
24 |
|
@@ -55,7 +57,6 @@
|
|
55 |
<form
|
56 |
class="fixed w-screen top-0 left-0 bottom-0 right-0 max-h-screen z-50 flex items-center justify-center bg-black bg-opacity-80 px-3"
|
57 |
on:submit|preventDefault={onPrompt}
|
58 |
-
on:click={cancel}
|
59 |
>
|
60 |
<div class="flex bg-white rounded-2xl px-2 w-full max-w-md">
|
61 |
<input
|
|
|
15 |
};
|
16 |
onMount(() => {
|
17 |
inputEl.focus();
|
18 |
+
inputEl.addEventListener('focusout', cancel);
|
19 |
prompt = '';
|
20 |
window.addEventListener('keyup', onKeyup);
|
21 |
return () => {
|
22 |
window.removeEventListener('keyup', onKeyup);
|
23 |
+
inputEl.removeEventListener('focusout', cancel);
|
24 |
};
|
25 |
});
|
26 |
|
|
|
57 |
<form
|
58 |
class="fixed w-screen top-0 left-0 bottom-0 right-0 max-h-screen z-50 flex items-center justify-center bg-black bg-opacity-80 px-3"
|
59 |
on:submit|preventDefault={onPrompt}
|
|
|
60 |
>
|
61 |
<div class="flex bg-white rounded-2xl px-2 w-full max-w-md">
|
62 |
<input
|