From b925cf1e7a47b16531454b20f0483492012e0a82 Mon Sep 17 00:00:00 2001 From: sudhir Date: Tue, 21 Apr 2026 15:11:46 +0530 Subject: [PATCH] Show paint cursor on incompatible clicks --- packages/editor/src/components/editor/index.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/editor/src/components/editor/index.tsx b/packages/editor/src/components/editor/index.tsx index 20e5669e..08ee4eaf 100644 --- a/packages/editor/src/components/editor/index.tsx +++ b/packages/editor/src/components/editor/index.tsx @@ -686,6 +686,7 @@ function PaintCursorLayer({ const activePaintTarget = useEditor((s) => s.activePaintTarget) const paintDisabledFeedbackTick = useEditor((s) => s.paintDisabledFeedbackTick) const badgeRef = useRef(null) + const lastPointerPositionRef = useRef<{ x: number; y: number } | null>(null) const [showDisabledFeedback, setShowDisabledFeedback] = useState(false) const active = mode === 'material-paint' && !isVersionPreviewMode @@ -714,6 +715,7 @@ function PaintCursorLayer({ const rect = el.getBoundingClientRect() nextX = e.clientX - rect.left nextY = e.clientY - rect.top + lastPointerPositionRef.current = { x: nextX, y: nextY } if (frame === 0) { frame = window.requestAnimationFrame(flushPosition) @@ -755,10 +757,16 @@ function PaintCursorLayer({ if (!paintDisabledFeedbackTick) return const el = containerRef.current + const badge = badgeRef.current + const lastPointerPosition = lastPointerPositionRef.current setShowDisabledFeedback(true) if (el) { el.style.cursor = 'not-allowed' } + if (badge && lastPointerPosition) { + badge.style.display = 'block' + badge.style.transform = `translate(${lastPointerPosition.x + PAINT_CURSOR_BADGE_OFFSET_X}px, ${lastPointerPosition.y + PAINT_CURSOR_BADGE_OFFSET_Y}px)` + } const timeoutId = window.setTimeout(() => { setShowDisabledFeedback(false) if (containerRef.current) {