Fix fill color backup not capturing most recent color selection#3918
Fix fill color backup not capturing most recent color selection#3918ziad-ashraf7 wants to merge 3 commits intoGraphiteEditor:masterfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves an issue where the fill color would not persist correctly when users switched between solid and gradient fill modes in the color picker. The problem stemmed from the backup mechanism for colors being one step behind the actual user selection, leading to the loss of the most recently chosen color. The implemented fix updates the logic to ensure the backup slot is always populated with the current color or gradient selection, thereby preventing unexpected color resets. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
The changes correctly address the reported bug where the fill color backup was not capturing the most recent color selection. By switching the match expression to use x.value (the current input from the ColorInput widget) instead of fill2 (the stale captured value), the backup slot now accurately reflects the user's latest selection. The logic for updating the BackupGradientInput correctly preserves the existing gradient type and direction while updating only the color stops, which is crucial for maintaining gradient configuration. The changes are well-aligned with the problem description and provide a precise fix.
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="editor/src/messages/portfolio/document/node_graph/node_properties.rs">
<violation number="1" location="editor/src/messages/portfolio/document/node_graph/node_properties.rs:1868">
P2: Gradient backup now clones stale `BackupGradientInput` and only replaces stops, so gradient type/orientation metadata can regress when restoring fill.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
editor/src/messages/portfolio/document/node_graph/node_properties.rs
Outdated
Show resolved
Hide resolved
|
Hi @Keavon , Thank you in advance! |
Fixes: #3824
Before
before.mp4
After
2026-03-19.21-56-03.mp4
Description:
Fixes solid color being lost when switching between Solid and Gradient fill modes after clicking (not dragging) on the color picker.
When a user clicks on the color picker to select a color (e.g., red) for a solid fill, then switches to Gradient mode and back to Solid mode, the color would incorrectly reset to white instead of preserving the previously selected red.
Root cause: In the
fill_properties()function, the backup color/gradient was being set based on fill2 (the old fill value captured at function entry) rather than x.value (the new value the user just selected). This caused the backup to always be one step behind the actual selection.Fix: Changed the match expression to use x.value (the current input) instead of fill2 (the stale captured value), ensuring the backup slot always contains the most up-to-date color selection.