diff --git a/eslint.config.js b/eslint.config.js index f829a37..5221736 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -36,5 +36,5 @@ export default ts.config( parser: ts.parser, }, }, - { ignores: ['dist/'] }, + { ignores: ['dist/', 'buboard-dist/'] }, ); diff --git a/src/App.svelte b/src/App.svelte index 1bd277e..10fa61b 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -43,7 +43,7 @@
{#if !interfaceHidden} - (interfaceHidden = true)} /> + { interfaceHidden = true; appState.setLocked(true); }} /> {/if}
@@ -63,7 +63,7 @@
{#if interfaceHidden}
- {#each ['1', '2', '3', '4', '5', '6', '7', '8', '9'] as key (key)} diff --git a/src/lib/Canvas.svelte b/src/lib/Canvas.svelte index 4b7e0ba..d08868f 100644 --- a/src/lib/Canvas.svelte +++ b/src/lib/Canvas.svelte @@ -38,7 +38,8 @@ function handleWheel(e: WheelEvent) { e.preventDefault(); - const factor = e.deltaY > 0 ? 0.9 : 1.1; + const delta = e.deltaY * (e.deltaMode === 1 ? 16 : 1); + const factor = Math.pow(0.995, delta); const rect = container.getBoundingClientRect(); const cx = e.clientX - rect.left; const cy = e.clientY - rect.top; @@ -47,6 +48,7 @@ function handleDrop(e: DragEvent) { e.preventDefault(); + if (state.locked) return; const files = e.dataTransfer?.files; if (!files || files.length === 0) return; @@ -137,6 +139,14 @@ if (tag === 'INPUT' || tag === 'TEXTAREA') return; if ((e.target as HTMLElement)?.isContentEditable) return; + if (e.key === 'Escape') { + state.clearSelection(); + state.focus(null); + return; + } + + if (state.locked) return; + const mod = e.metaKey || e.ctrlKey; const rect = container.getBoundingClientRect(); const centerX = (rect.width / 2 - state.viewport.x) / state.viewport.zoom; @@ -163,9 +173,6 @@ for (let i = 1; i < newIds.length; i++) { state.toggleSelection(newIds[i]); } - } else if (e.key === 'Escape') { - state.clearSelection(); - state.focus(null); } else if (e.key === '[' && hasSelection) { e.preventDefault(); for (const id of state.selectedIds) { diff --git a/src/lib/Item.svelte b/src/lib/Item.svelte index 2aaeb28..02d0710 100644 --- a/src/lib/Item.svelte +++ b/src/lib/Item.svelte @@ -191,6 +191,7 @@ z-index: {item.zIndex}; cursor: {cursorStyle()}; --handle-scale: {handleScale()}; + {appState.locked ? 'pointer-events: none;' : ''} " onmousedown={handleMouseDown} ondblclick={handleDoubleClick} diff --git a/src/lib/Palette.svelte b/src/lib/Palette.svelte index 644a57e..a6e736b 100644 --- a/src/lib/Palette.svelte +++ b/src/lib/Palette.svelte @@ -2,6 +2,8 @@ import { Square, Type, Image, Music, Video, Globe } from 'lucide-svelte'; import { state } from './state.svelte'; + let locked = $derived(state.locked); + let imageInput: HTMLInputElement; let soundInput: HTMLInputElement; let videoInput: HTMLInputElement; @@ -172,36 +174,38 @@ } -
- - - - - - +{#if !locked} +
+ + + + + + - - - -
+ + + +
+{/if}