Skip to content

Fix fill color backup not capturing most recent color selection#3918

Open
ziad-ashraf7 wants to merge 3 commits intoGraphiteEditor:masterfrom
ziad-ashraf7:fix-color-picker-radial-hue
Open

Fix fill color backup not capturing most recent color selection#3918
ziad-ashraf7 wants to merge 3 commits intoGraphiteEditor:masterfrom
ziad-ashraf7:fix-color-picker-radial-hue

Conversation

@ziad-ashraf7
Copy link

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.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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

  • Fill Color Persistence Fix: Addressed a bug where the selected solid fill color would incorrectly reset to white after switching between Solid and Gradient fill modes and back, instead of preserving the previously chosen color.
  • Backup Mechanism Correction: Modified the fill_properties() function to ensure the backup color/gradient slot always stores the most recent user selection by utilizing x.value (the current input) instead of the stale fill2 variable.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ziad-ashraf7
Copy link
Author

Hi @Keavon ,
I'd really appreciate your valuable feedback here, if i did any thing wrong or not aligned with the contributors guide, pls let me know immediately.

Thank you in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gradient functionality seems broken.

1 participant