diff --git a/src/css/style.css b/src/css/style.css index 8fb74d6..6b80367 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -376,4 +376,24 @@ p:has(+ ol) { box-shadow: 0 0px 16px rgba(0, 0, 0, 0.15); overflow: hidden; background-color: white; +} + +.lock-indicator { + position: absolute; + width: 24px; + height: 24px; + background: white; + border-radius: 4px; + box-shadow: 0 1px 3px rgba(0,0,0,0.2); + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + z-index: 1000; + transition: transform 0.2s ease; +} + +.lock-indicator:hover { + transform: scale(1.1) !important; + background: #f0f0f0; } \ No newline at end of file diff --git a/src/routes/Board.tsx b/src/routes/Board.tsx index 38e5e69..d67f9a9 100644 --- a/src/routes/Board.tsx +++ b/src/routes/Board.tsx @@ -1,6 +1,6 @@ import { useSync } from "@tldraw/sync" import { useMemo, useEffect, useState } from "react" -import { Tldraw, Editor } from "tldraw" +import { Tldraw, Editor, TLShapeId } from "tldraw" import { useParams } from "react-router-dom" import { ChatBoxTool } from "@/tools/ChatBoxTool" import { ChatBoxShape } from "@/shapes/ChatBoxShapeUtil" @@ -30,7 +30,13 @@ import { makeRealSettings, applySettingsMigrations } from "@/lib/settings" import { PromptShapeTool } from "@/tools/PromptShapeTool" import { PromptShape } from "@/shapes/PromptShapeUtil" import { llm } from "@/utils/llmUtils" -import { setInitialCameraFromUrl } from "@/ui/cameraUtils" +import { + lockElement, + unlockElement, + setInitialCameraFromUrl, + initLockIndicators, + watchForLockedShapes, +} from "@/ui/cameraUtils" // Default to production URL if env var isn't available export const WORKER_URL = "https://jeffemmett-canvas.jeffemmett.workers.dev" @@ -84,6 +90,13 @@ export function Board() { } }, []) + // Remove the URL-based locking effect and replace with store-based initialization + useEffect(() => { + if (!editor) return + initLockIndicators(editor) + watchForLockedShapes(editor) + }, [editor]) + return (