Spaces:
Runtime error
Runtime error
cleaning
Browse files- frontend/src/app.d.ts +1 -0
- frontend/src/lib/Buttons/DragButton.svelte +3 -1
- frontend/src/lib/Buttons/MaskButton.svelte +3 -2
- frontend/src/lib/Buttons/PPButton.svelte +1 -1
- frontend/src/lib/Buttons/UndoButton.svelte +1 -1
- frontend/src/lib/PaintFrame.svelte +1 -1
- frontend/src/lib/PromptModal.svelte +3 -8
frontend/src/app.d.ts
CHANGED
@@ -14,6 +14,7 @@ declare global {
|
|
14 |
}
|
15 |
}
|
16 |
interface Event {
|
|
|
17 |
transform: ZoomTransform;
|
18 |
x: number;
|
19 |
y: number;
|
|
|
14 |
}
|
15 |
}
|
16 |
interface Event {
|
17 |
+
relatedTarget: EventTarget | null;
|
18 |
transform: ZoomTransform;
|
19 |
x: number;
|
20 |
y: number;
|
frontend/src/lib/Buttons/DragButton.svelte
CHANGED
@@ -8,7 +8,9 @@
|
|
8 |
<button
|
9 |
on:click
|
10 |
disabled={isLoading}
|
11 |
-
class="{className} shadow-lg bg-white rounded-full {isActive
|
|
|
|
|
12 |
title="Enable Dragging"
|
13 |
>
|
14 |
<Move />
|
|
|
8 |
<button
|
9 |
on:click
|
10 |
disabled={isLoading}
|
11 |
+
class="{className} shadow-lg bg-white rounded-full disabled:opacity-50 {isActive
|
12 |
+
? 'text-blue-700'
|
13 |
+
: 'text-gray-800'}"
|
14 |
title="Enable Dragging"
|
15 |
>
|
16 |
<Move />
|
frontend/src/lib/Buttons/MaskButton.svelte
CHANGED
@@ -3,13 +3,14 @@
|
|
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
|
|
|
|
|
13 |
title="Enable Masking"
|
14 |
>
|
15 |
<Mask />
|
|
|
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} rounded-full disabled:opacity-50 {isActive
|
12 |
+
? 'text-blue-700'
|
13 |
+
: 'text-gray-800'}"
|
14 |
title="Enable Masking"
|
15 |
>
|
16 |
<Mask />
|
frontend/src/lib/Buttons/PPButton.svelte
CHANGED
@@ -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 text-base font-mono bg-violet-100 text-violet-900 min-w-[25ch] flex justify-center items-center disabled:opacity-
|
28 |
}
|
29 |
</style>
|
|
|
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-base font-mono bg-violet-100 text-violet-900 min-w-[25ch] flex justify-center items-center disabled:opacity-50 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
@@ -8,7 +8,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"
|
|
|
8 |
<button
|
9 |
on:click
|
10 |
disabled={isLoading}
|
11 |
+
class="{className} bg-white rounded-full disabled:opacity-50 bg-white rounded-full {isActive
|
12 |
? 'text-blue-700'
|
13 |
: 'text-gray-800'}"
|
14 |
title="Clear Masking"
|
frontend/src/lib/PaintFrame.svelte
CHANGED
@@ -127,7 +127,7 @@
|
|
127 |
if (typeof TouchEvent !== 'undefined' && event.sourceEvent instanceof TouchEvent) {
|
128 |
offsetX = event.sourceEvent.targetTouches[0].pageX - rect.left;
|
129 |
offsetY = event.sourceEvent.targetTouches[0].pageY - rect.top;
|
130 |
-
} else {
|
131 |
offsetX = event.sourceEvent.pageX - rect.left;
|
132 |
offsetY = event.sourceEvent.pageY - rect.top;
|
133 |
}
|
|
|
127 |
if (typeof TouchEvent !== 'undefined' && event.sourceEvent instanceof TouchEvent) {
|
128 |
offsetX = event.sourceEvent.targetTouches[0].pageX - rect.left;
|
129 |
offsetY = event.sourceEvent.targetTouches[0].pageY - rect.top;
|
130 |
+
} else if (event.sourceEvent instanceof MouseEvent) {
|
131 |
offsetX = event.sourceEvent.pageX - rect.left;
|
132 |
offsetY = event.sourceEvent.pageY - rect.top;
|
133 |
}
|
frontend/src/lib/PromptModal.svelte
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<script lang="ts">
|
2 |
-
import { createEventDispatcher, onMount
|
3 |
import { useMyPresence } from '$lib/liveblocks';
|
4 |
import { Status } from '$lib/types';
|
5 |
|
@@ -7,7 +7,6 @@
|
|
7 |
export let initPrompt = '';
|
8 |
let prompt: string;
|
9 |
let inputEl: HTMLInputElement;
|
10 |
-
let buttonEl: HTMLElement;
|
11 |
const myPresence = useMyPresence();
|
12 |
|
13 |
const onKeyup = (e: KeyboardEvent) => {
|
@@ -50,7 +49,6 @@
|
|
50 |
debouce(target.value);
|
51 |
}
|
52 |
function cancel(event?: Event) {
|
53 |
-
console.log(event?.relatedTarget)
|
54 |
if (!(event instanceof KeyboardEvent) && event?.relatedTarget !== null) return;
|
55 |
|
56 |
myPresence.update({
|
@@ -76,11 +74,8 @@
|
|
76 |
type="text"
|
77 |
name="prompt"
|
78 |
/>
|
79 |
-
<button
|
80 |
-
|
81 |
-
on:click|preventDefault={onPrompt}
|
82 |
-
class="font-mono border-l-2 pl-2"
|
83 |
-
type="submit">Paint</button
|
84 |
>
|
85 |
</div>
|
86 |
</form>
|
|
|
1 |
<script lang="ts">
|
2 |
+
import { createEventDispatcher, onMount } from 'svelte';
|
3 |
import { useMyPresence } from '$lib/liveblocks';
|
4 |
import { Status } from '$lib/types';
|
5 |
|
|
|
7 |
export let initPrompt = '';
|
8 |
let prompt: string;
|
9 |
let inputEl: HTMLInputElement;
|
|
|
10 |
const myPresence = useMyPresence();
|
11 |
|
12 |
const onKeyup = (e: KeyboardEvent) => {
|
|
|
49 |
debouce(target.value);
|
50 |
}
|
51 |
function cancel(event?: Event) {
|
|
|
52 |
if (!(event instanceof KeyboardEvent) && event?.relatedTarget !== null) return;
|
53 |
|
54 |
myPresence.update({
|
|
|
74 |
type="text"
|
75 |
name="prompt"
|
76 |
/>
|
77 |
+
<button on:click|preventDefault={onPrompt} class="font-mono border-l-2 pl-2" type="submit"
|
78 |
+
>Paint</button
|
|
|
|
|
|
|
79 |
>
|
80 |
</div>
|
81 |
</form>
|