ux: normalize canvas cursor states#838
Conversation
✅ Deploy Preview for circuitverse ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughThe cursor styling logic in 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/simulator/src/engine.js`:
- Around line 293-327: The cursor mapping currently sets crosshair/move/grab and
deviates from the PR objective; update the logic in the hover/cursor block that
uses simulationArea, simulationArea.hover (hover) and hover.objectType (type) so
that: when simulationArea.mouseDown the cursor remains 'grabbing'; when hover
exists and hover.objectType corresponds to interactive elements (at least 'Node'
and 'Wire' — extendable to modules/subcircuits) set
simulationArea.canvas.style.cursor = 'pointer'; otherwise (no hover and not
mouseDown) set simulationArea.canvas.style.cursor = 'default'. Ensure you
replace the existing type-specific branches (crosshair/move/grab) and only use
the identifiers simulationArea, hover, type, and
simulationArea.canvas.style.cursor.
79b23af to
7a0bf26
Compare
|
Fixed by updating the commit message to follow Conventional Commits. All checks are now passing. |
|
@tachyons @Nihal4777 @ThatDeparted2061 kindly review ! |
|
Can you pelase add fixes # issue number @yashveer-1 |

Fixes #
Describe the changes you have made in this PR -
This PR standardizes cursor behavior on the simulation canvas to ensure it matches the intended UX guidelines and remains consistent across interactions.
pointerwhen hovering over interactive elements (nodes and wires)grabbingwhile dragging or panning the canvasScreenshots of the UI changes (If any) -
11111111.mp4
Code Understanding and AI Usage
Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code?
If you used AI assistance:
Explain your implementation approach:
This change improves UX by aligning cursor feedback with user expectations and documented behavior.
Previously, cursor updates could feel inconsistent because they were derived implicitly from interaction state.
This implementation centralizes cursor handling in
renderCanvas, where the full interaction context(mouse state and hover target) is already resolved.
The logic intentionally limits cursor styles to:
pointerfor interactive elementsgrabbingduring drag/pan actionsdefaultwhen idleThis avoids introducing new cursor semantics and ensures predictable behavior without impacting
simulation, selection, or event handling logic.
Checklist before requesting a review
Note: Please check Allow edits from maintainers if you would like us to assist in the PR.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.