Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Make the Outline render mode draw with consistent stroke thickness at any viewport zoom#3848

Merged
Keavon merged 2 commits intomasterfrom
non-scaling-outline-thickness
Mar 3, 2026
Merged

Make the Outline render mode draw with consistent stroke thickness at any viewport zoom#3848
Keavon merged 2 commits intomasterfrom
non-scaling-outline-thickness

Conversation

@Keavon
Copy link
Member

@Keavon Keavon commented Mar 3, 2026

Closes #2526

@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 refactors the handling of non-scaling stroke outlines by removing a dedicated non_scaling property and instead implementing a dynamic adjustment based on the viewport's zoom level. This change streamlines the stroke rendering logic and ensures that outline thicknesses remain visually consistent regardless of the editor's zoom, particularly within the outline rendering mode.

Highlights

  • Removed non_scaling property for strokes: The non_scaling boolean field has been removed from the Stroke struct, simplifying its definition and removing the explicit vector-effect="non-scaling-stroke" attribute from SVG rendering.
  • Introduced viewport_zoom for dynamic outline thickness: A new viewport_zoom field was added to RenderParams to allow for dynamic adjustment of outline stroke thickness based on the current zoom level, ensuring consistent visual appearance in outline mode.
  • Updated outline stroke width calculation: The calculation for outline stroke width now incorporates the viewport_zoom and element transform scale, providing a more accurate and responsive non-scaling behavior.
Changelog
  • editor/src/messages/portfolio/document/data_panel/data_panel_message_handler.rs
    • Removed the display of the 'Stroke Non-Scaling' property in the data panel.
  • editor/src/messages/portfolio/document/graph_operation/graph_operation_message_handler.rs
    • Removed the non_scaling field from the Stroke initialization.
  • node-graph/libraries/rendering/src/render_ext.rs
    • Removed the logic that added the vector-effect="non-scaling-stroke" attribute during SVG rendering.
  • node-graph/libraries/rendering/src/renderer.rs
    • Added a viewport_zoom field to the RenderParams struct.
    • Updated the Hash implementation for RenderParams to include viewport_zoom.
    • Introduced a viewport_zoom() getter method for RenderParams.
    • Modified the outline stroke width calculation to divide by the maximum scale and viewport_zoom.
  • node-graph/libraries/vector-types/src/vector/style.rs
    • Removed the non_scaling field from the Stroke struct.
    • Removed non_scaling from the Stroke's Hash implementation.
    • Removed non_scaling initialization from Stroke::new() and Stroke::lerp().
    • Removed the with_non_scaling method from Stroke.
    • Removed non_scaling from the Default implementation for Stroke.
  • node-graph/nodes/gstd/src/render_node.rs
    • Initialized the new viewport_zoom field in RenderParams using the footprint's decomposed scale.
  • node-graph/nodes/vector/src/vector_nodes.rs
    • Removed the non_scaling field from Stroke initialization within vector nodes.
Activity
  • No activity has been recorded for this pull request yet.
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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

@Keavon Keavon changed the title Non scaling outline thickness Make the Outline render mode draw with consistent stroke thickness at any viewport zoom Mar 3, 2026
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

This pull request refactors the non-scaling stroke feature by removing the non_scaling flag from the Stroke struct and instead calculating the stroke width at render time. This is a good architectural improvement. A new viewport_zoom parameter is added to RenderParams to correctly calculate the outline stroke width to be constant in screen space.

However, I found an issue in the max_scale helper function which is used for this calculation. It incorrectly uses the Frobenius norm, which leads to incorrect scaling of stroke widths. I've provided a suggestion to fix this. Other than that, the changes look good and consistent across the codebase.

Copy link

@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 7 files

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="node-graph/libraries/rendering/src/renderer.rs">

<violation number="1" location="node-graph/libraries/rendering/src/renderer.rs:202">
P2: Hash uses the raw `viewport_zoom` field, but rendering uses the `viewport_zoom()` method which normalizes `<= 0` to `1.0`. This means `RenderParams` with `viewport_zoom = 0.0` (the `Default`) and `viewport_zoom = 1.0` hash differently despite producing identical output, causing unnecessary cache invalidations. Hash the normalized value instead.

(Based on your team's feedback about avoiding misleading or inconsistent hashing implementations.) [FEEDBACK_USED]</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@Keavon Keavon force-pushed the non-scaling-outline-thickness branch from ceb6592 to a07a458 Compare March 3, 2026 03:57
@Keavon Keavon merged commit 7cc3097 into master Mar 3, 2026
6 checks passed
@Keavon Keavon deleted the non-scaling-outline-thickness branch March 3, 2026 04:13
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.

Add Vello support for non-scaling stroke width

1 participant