fix(review): address code review findings — tool conflicts, dual inputs, pin animation
1. TEXT and ERASER tool clicks now suppressed during review mode via reviewMode flag on ToolContext (read from ref for live value) 2. Object-comment input hidden when draftPin is active — only one creation input visible at a time 3. PinOverlay entrance animation removed — focus styling (scale 1.15x, alpha changes) no longer fights with fade-in animation loop
This commit is contained in:
@@ -102,6 +102,7 @@ export default function Editor({ isPublicView }: EditorProps) {
|
||||
const [showMmImport, setShowMmImport] = useState(false);
|
||||
const [showExport, setShowExport] = useState(false);
|
||||
const [reviewMode, setReviewMode] = useState(false);
|
||||
const reviewModeRef = useRef(false);
|
||||
const [focusedThreadId, setFocusedThreadId] = useState<string | null>(null);
|
||||
// Pulse signal: threadId to open, or null to collapse detail view
|
||||
const [expandRequest, setExpandRequest] = useState<{ threadId: string | null; seq: number } | null>(null);
|
||||
@@ -201,6 +202,11 @@ export default function Editor({ isPublicView }: EditorProps) {
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [objectCount]);
|
||||
|
||||
// Keep reviewModeRef in sync for tool handlers to read
|
||||
useEffect(() => {
|
||||
reviewModeRef.current = reviewMode;
|
||||
}, [reviewMode]);
|
||||
|
||||
// Pins visible only in review mode
|
||||
useEffect(() => {
|
||||
if (!pinOverlay) return;
|
||||
@@ -404,6 +410,8 @@ export default function Editor({ isPublicView }: EditorProps) {
|
||||
textEditor: textEditor ?? undefined,
|
||||
switchToSelect: () => setActiveTool(ToolType.SELECT),
|
||||
};
|
||||
// reviewMode is read at click time via getter so it stays current
|
||||
Object.defineProperty(ctx, 'reviewMode', { get: () => reviewModeRef.current });
|
||||
toolCleanupRef.current = activateTool(ctx, activeTool, { color, strokeWidth, fontSize });
|
||||
}, [activeTool, color, strokeWidth, fontSize, onCanvasChange, textEditor]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user