Enable direct canvas painting while color picker is open#325
Merged
tracygardner merged 1 commit intomainfrom Feb 26, 2026
Merged
Enable direct canvas painting while color picker is open#325tracygardner merged 1 commit intomainfrom
tracygardner merged 1 commit intomainfrom
Conversation
When the colour picker is open, clicking or tapping on any mesh in the
3D scene now immediately applies the currently selected colour without
needing to press 'Use' first. The picker stays open so multiple meshes
can be painted in one session.
On mouse/pointer devices the crosshair cursor appears as soon as the
pointer moves off the colour picker popup onto the canvas (via a CSS
body class), rather than only after pressing 'Use'.
Implementation:
- colourpicker.js: add `excludeFromClose` callback option so callers
can exempt specific elements (e.g. the canvas) from triggering the
outside-click-to-close behaviour; add/remove `color-picker-open`
body class on open/close for CSS cursor targeting
- gizmos.js: pass `excludeFromClose` that exempts #renderCanvas; add
a persistent click handler on the canvas that applies the picker's
live colour whenever the picker is open
- style.css: `body.color-picker-open #renderCanvas { cursor: crosshair }`
https://claude.ai/code/session_01DAYassUFrMjCRWJQyiyQgG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds the ability to directly paint on the canvas by clicking/tapping while the color picker is open, without requiring users to confirm the color selection first. It also improves UX by showing a crosshair cursor on the canvas when the picker is active.
Key Changes
excludeFromClosecallback in the color picker to prevent the picker from closing when clicking on the canvas itselfcolor-picker-openclass tobodywhen picker opens/closes, enabling a crosshair cursor on the canvas via CSSisOpenstate more reliably by adding/removing the body class inopen()andclose()methodsImplementation Details
currentColor(live color) rather than waiting for confirmation via the "Use" buttongetCanvasXAndCanvasYValues()before applying colorexcludeFromCloseoption allows the color picker to remain open after canvas interactions, improving workflow efficiencyhttps://claude.ai/code/session_01DAYassUFrMjCRWJQyiyQgG