Spaces:
Runtime error
Runtime error
minor design improvements
Browse files
frontend/src/lib/About.svelte
CHANGED
@@ -58,7 +58,7 @@
|
|
58 |
<p class="text-base flex items-center">
|
59 |
Multiplayer API by
|
60 |
<a href="https://liveblocks.io" target="_blank" rel="noopener noreferrer">
|
61 |
-
<LiveBlocks
|
62 |
</a>
|
63 |
</p>
|
64 |
</li>
|
|
|
58 |
<p class="text-base flex items-center">
|
59 |
Multiplayer API by
|
60 |
<a href="https://liveblocks.io" target="_blank" rel="noopener noreferrer">
|
61 |
+
<LiveBlocks classList={'ml-2'} />
|
62 |
</a>
|
63 |
</p>
|
64 |
</li>
|
frontend/src/lib/App.svelte
CHANGED
@@ -137,6 +137,9 @@
|
|
137 |
myPresence.update({
|
138 |
status: Status.ready
|
139 |
});
|
|
|
|
|
|
|
140 |
}
|
141 |
websocket.close();
|
142 |
return;
|
|
|
137 |
myPresence.update({
|
138 |
status: Status.ready
|
139 |
});
|
140 |
+
setTimeout(() => {
|
141 |
+
$loadingState = '';
|
142 |
+
}, 2000);
|
143 |
}
|
144 |
websocket.close();
|
145 |
return;
|
frontend/src/lib/Frame.svelte
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
transform: translateX(${coord.x}px) translateY(${coord.y}px) scale(${transform.k}); transform-origin: 0 0;`}
|
21 |
>
|
22 |
<div class="pointer-events-none touch-none">
|
23 |
-
<div class="font-bold !text-4xl text-white rounded-2xl text-center p-10
|
24 |
{#if isLoading}
|
25 |
<LoadingIcon classList={'animate-spin text-4xl inline mr-2 mx-auto text-white mb-4'} />
|
26 |
<p class="text-4xl">Someone is painting:</p>
|
@@ -28,7 +28,7 @@
|
|
28 |
<p class="text-4xl">Someone is typing:</p>
|
29 |
{/if}
|
30 |
|
31 |
-
<span class="italic font-normal">"{prompt}"</span>
|
32 |
</div>
|
33 |
</div>
|
34 |
</div>
|
|
|
20 |
transform: translateX(${coord.x}px) translateY(${coord.y}px) scale(${transform.k}); transform-origin: 0 0;`}
|
21 |
>
|
22 |
<div class="pointer-events-none touch-none">
|
23 |
+
<div class="font-bold !text-4xl text-white rounded-2xl text-center p-10">
|
24 |
{#if isLoading}
|
25 |
<LoadingIcon classList={'animate-spin text-4xl inline mr-2 mx-auto text-white mb-4'} />
|
26 |
<p class="text-4xl">Someone is painting:</p>
|
|
|
28 |
<p class="text-4xl">Someone is typing:</p>
|
29 |
{/if}
|
30 |
|
31 |
+
<span class="italic font-normal line-clamp-4">"{prompt}"</span>
|
32 |
</div>
|
33 |
</div>
|
34 |
</div>
|
frontend/src/lib/Menu.svelte
CHANGED
@@ -23,7 +23,10 @@
|
|
23 |
|
24 |
<button
|
25 |
on:click={() => dispatch('prompt')}
|
26 |
-
|
|
|
|
|
|
|
27 |
><span class="mr-3">π</span>Paint
|
28 |
<span
|
29 |
class="bg-blue-800 text-gray-300 rounded-lg px-2 py-0.5 text-base ml-4 hidden sm:flex items-center translate-y-[2px]"
|
|
|
23 |
|
24 |
<button
|
25 |
on:click={() => dispatch('prompt')}
|
26 |
+
disabled={isLoading}
|
27 |
+
class="{isLoading
|
28 |
+
? 'cursor-wait'
|
29 |
+
: 'cursor-pointer'} order-first md:order-none text-3xl bg-blue-600 text-white px-6 py-2 rounded-2xl ring ring-blue-500 font-semibold shadow-2xl self-center flex items-center hover:saturate-150"
|
30 |
><span class="mr-3">π</span>Paint
|
31 |
<span
|
32 |
class="bg-blue-800 text-gray-300 rounded-lg px-2 py-0.5 text-base ml-4 hidden sm:flex items-center translate-y-[2px]"
|
frontend/src/lib/PaintCanvas.svelte
CHANGED
@@ -74,7 +74,7 @@
|
|
74 |
return zoomIdentity.translate(x, y).scale(k);
|
75 |
}
|
76 |
onMount(() => {
|
77 |
-
const padding =
|
78 |
const scale =
|
79 |
(width + padding * 2) /
|
80 |
(containerEl.clientHeight > containerEl.clientWidth
|
|
|
74 |
return zoomIdentity.translate(x, y).scale(k);
|
75 |
}
|
76 |
onMount(() => {
|
77 |
+
const padding = 50;
|
78 |
const scale =
|
79 |
(width + padding * 2) /
|
80 |
(containerEl.clientHeight > containerEl.clientWidth
|
frontend/src/lib/PaintFrame.svelte
CHANGED
@@ -43,6 +43,11 @@
|
|
43 |
y: transform.applyY(position.y)
|
44 |
};
|
45 |
|
|
|
|
|
|
|
|
|
|
|
46 |
let offsetX = 0;
|
47 |
let offsetY = 0;
|
48 |
|
@@ -192,6 +197,7 @@
|
|
192 |
function toggleDrawMask() {
|
193 |
dragEnabled = false;
|
194 |
cropCanvas(position);
|
|
|
195 |
myPresence.update({
|
196 |
status: Status.masking
|
197 |
});
|
@@ -219,17 +225,15 @@
|
|
219 |
/>
|
220 |
{/if}
|
221 |
<canvas
|
222 |
-
class={dragEnabled ? '' : 'bg-white'}
|
223 |
bind:this={$maskEl}
|
224 |
width={FRAME_SIZE}
|
225 |
height={FRAME_SIZE}
|
226 |
/>
|
227 |
-
<div class="pointer-events-none touch-none">
|
228 |
{#if prompt}
|
229 |
-
<div class="
|
230 |
-
|
231 |
-
{prompt}
|
232 |
-
</div>
|
233 |
</div>
|
234 |
{/if}
|
235 |
</div>
|
|
|
43 |
y: transform.applyY(position.y)
|
44 |
};
|
45 |
|
46 |
+
$: if ($loadingState === 'Complete' && !dragEnabled) {
|
47 |
+
cleanMask();
|
48 |
+
toggleDrag();
|
49 |
+
}
|
50 |
+
|
51 |
let offsetX = 0;
|
52 |
let offsetY = 0;
|
53 |
|
|
|
197 |
function toggleDrawMask() {
|
198 |
dragEnabled = false;
|
199 |
cropCanvas(position);
|
200 |
+
|
201 |
myPresence.update({
|
202 |
status: Status.masking
|
203 |
});
|
|
|
225 |
/>
|
226 |
{/if}
|
227 |
<canvas
|
228 |
+
class="{dragEnabled ? 'hidden' : 'bg-white block'} absolute top-0 left-0 z-0"
|
229 |
bind:this={$maskEl}
|
230 |
width={FRAME_SIZE}
|
231 |
height={FRAME_SIZE}
|
232 |
/>
|
233 |
+
<div class="pointer-events-none touch-none col-span-3 z-10">
|
234 |
{#if prompt}
|
235 |
+
<div class="font-bold text-4xl text-[#387CFF] text-center px-2 line-clamp-4">
|
236 |
+
{prompt}
|
|
|
|
|
237 |
</div>
|
238 |
{/if}
|
239 |
</div>
|
frontend/src/lib/constants.ts
CHANGED
@@ -17,8 +17,8 @@ export const EMOJIS = ['π', 'π', 'π', 'π', 'π¦', 'π', 'π', '
|
|
17 |
export const MAX_CAPACITY = 20;
|
18 |
|
19 |
export const CANVAS_SIZE = {
|
20 |
-
width: 512 *
|
21 |
-
height: 512 *
|
22 |
}
|
23 |
export const GRID_SIZE = 32
|
24 |
|
|
|
17 |
export const MAX_CAPACITY = 20;
|
18 |
|
19 |
export const CANVAS_SIZE = {
|
20 |
+
width: 512 * 8,
|
21 |
+
height: 512 * 8,
|
22 |
}
|
23 |
export const GRID_SIZE = 32
|
24 |
|