Skip to content

Sync Commits #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
May 12, 2025
Merged

Sync Commits #1

merged 15 commits into from
May 12, 2025

Conversation

Daniel53245
Copy link
Owner

@Daniel53245 Daniel53245 commented May 12, 2025

Closes #

Summary by CodeRabbit

  • New Features

    • Overlay visibility controls are now more granular, allowing users to toggle individual overlay types (e.g., artboard names, compass rose, quick measurement, transform cage, selection outline, path, anchors, handles, etc.) via a new popover menu in the document bar.
    • Enum-based dropdown and radio button widgets are now auto-generated and unified, providing a more consistent and maintainable UI for node properties.
    • New vector path sampling, position, and tangent evaluation features for advanced path manipulation.
  • Improvements

    • Overlay rendering and tool overlay logic now respect the new per-overlay visibility settings, enabling or disabling visual elements accordingly.
    • Enhanced snapping options in the line tool, including midpoint snapping.
    • Boolean operation menus and tooltips now display richer information and icons.
    • Node parameter validation supports both soft and hard numeric bounds, with hard bounds enforced at runtime.
    • Many vector and raster node parameters now have stricter validation and improved UI hints.
    • Selection tools and shape editors gain improved control over handle and anchor selection/deselection.
  • Bug Fixes

    • Overlay and tool logic now correctly disables or enables elements based on visibility settings, preventing unwanted rendering.
    • Gamma correction and numeric parameter clamping now handle edge cases to prevent invalid values.
  • Refactor

    • Major refactor of overlay visibility state, enum widget construction, and vector node processing to improve maintainability and extensibility.
  • Tests

    • Added extensive tests for freehand drawing tool behavior and vector path manipulation utilities.
  • Documentation

    • Improved code comments, parameter documentation, and example code snippets for clarity.
  • Style

    • Minor stylistic and formatting changes for code consistency.

Daniel53245 and others added 15 commits April 30, 2025 04:22
fix too greedy node deletion search

Co-authored-by: CaligulaAlucard <caligulaalucard@localhost.localdomain>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
…e Kurbo API (#2611)

* rough refactor of Position on Path node

* refactor

* refactor 'Tangent on Path' node implementation to use kurbo API

* Code review

---------

Co-authored-by: indierusty <priyaayadav@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
* line midpoint snapper

* Add to snap option menu

* remove being_drawn_line_midpoint

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
Fix slow svg import

Co-authored-by: Keavon Chambers <keavon@keavon.com>
* Added granular overlays control based on features

* Added basic support for pivot, path, anchors and handles overlay settings

* Added more overlay checks on anchors and handles

* Add new settings over measurements, hover and selection overlays

* Fix errors introduced while rebasing

* Disable anchors and handles functionality with their overlays, extended selection outline check

* Add check to enable/disable outlines on selected layers

* Toggle handles checkbox in sync with anchors checkbox

* Refactor overlays checks

* Remove debug statements

* Update select_tool.rs to resolve conflict

* Minor fix to reflect anchor checkbox state on the handles

* Minor fix to make anchors checkbox work

* Rearrange menu items, and code review

* Fix pivot dragging

* Add handles overlay check when drawing with pen tool

* Fix constrained dragging when transform cage is disabled

* Fix deselecting user selection when anchors are disabled

* Minor fix for disabling anchors

* Remove All from OverlaysType

* Remove debug statements

* Fix editor crash when selecting other layers with path tool and anchors disabled

* Minor fix on overlays check for all overlays

* Add proper code formatting

* Nits

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
* Add tests for freehand tool

* add test: line weight affects stroke width

* refactor
… make them clamp their input data (#2464)

* Fix min and max macro not enforcing limits when data flows

* Use trait based clamping

* Remove min/max from testing

* cargo fmt

* Resolve into min, and hard_min

* cargo fmt

* fix traits

* cargo fmt

* fix tests

* rename as soft_x

* Add validation code

* Clean up (not compiling because of DVec2 clamping)

* Avoid needing to add trait bounds to node definitions

* Code review

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
…down menus (#2589)

* First draft of factoring out the dropdown boilerplate

* Add proc macro for enum boilerplate

* Detect whether to say `crate` or the name

* Clean up the input and naming of the enum macro

* Rename a file

* Do the rename of code too

* Use the attribute-driven selection of radio vs dropdown

* Add a metadata struct and tooltips

* Move the new traits to a better place.

* Use ChoiceType, part 1

* Use ChoiceType, part 2

* Introduce a builder API for choice widgets

* Start using the new new API

* DomainWarpType should be a dropdown still

* Handle the case where a node property can never have a socket

* Rustfmt

* Code review

* Update stable node IDs in test

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
…2629)

* fix naming

* refactor sample_points node/function.

* avoid recalculating segments length to find point on bezpath.

* cleanup

* rename few variables

* fix transformation and use precomputed segment lengths

* write comments

* set POSITION_ACCURACY and PERIMETER_ACCURACY to smaller value to get better approximate euclidean position on a path

* fix segment index when t value is 1.0

* Improve comments

* move sampling points code into a separate function

* it works! finding the segment index is linear now!

* small fix and improve variable names & comment

* Naming

* evaluate segment at t as euclidean distance. fix.

* improve comment & variable name

---------

Co-authored-by: indierusty <priyaayadav@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
… next deeper object (#2639)

* Fix overlay behaviour on hovering over a layer

* Add the deepen overlay code

* cleanup
#2637)

* Avoid allocating a Vec when precomputed segments lengths is provided.

* improved using option type.

* we don't even need option type as Vec::new() doesn't allocate.

* clean up
Copy link

coderabbitai bot commented May 12, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces a granular overlay visibility system, replacing the previous global boolean flag with a structured settings object that allows independent control over each overlay type (such as artboard names, handles, anchors, compass rose, etc.). The UI is updated to provide individual checkboxes for each overlay. The overlay rendering logic throughout the editor and tool codebase is refactored to respect these new visibility settings. Additionally, the node system and UI widget generation for enums are overhauled to use a generic, metadata-driven approach, leveraging a new procedural macro to automatically generate choice-type metadata, display, and widget integration for enums. Several numeric parameter attributes are changed to distinguish between soft and hard bounds, with runtime clamping logic added for hard bounds. The node graph core and vector processing modules gain new features, including a public clamping trait, enhanced enum metadata, and new algorithms for Bézier path evaluation and sampling.

Changes

File(s) / Path(s) Change Summary
editor/src/messages/portfolio/document/document_message.rs,
.../document_message_handler.rs,
.../overlays/overlays_message_handler.rs,
.../overlays/utility_functions.rs,
.../overlays/utility_types.rs,
.../graph_operation/graph_operation_message_handler.rs,
.../node_graph/document_node_definitions.rs,
.../node_graph/node_properties.rs,
.../utility_types/network_interface.rs,
.../menu_bar/menu_bar_message_handler.rs,
.../test_utils.rs
Overhaul of overlay visibility: replaced global flag with per-type settings struct, updated message and handler signatures, UI checkboxes, overlay rendering, and document bar layout. Added overlay type enum and settings struct, updated overlay context and drawing logic, and adjusted related message handling and UI.
editor/src/messages/tool/common_functionality/pivot.rs,
.../shape_editor.rs,
.../snapping.rs,
.../transformation_cage.rs
Overlay visibility gating for pivot, shape editor, snapping, and transformation cage logic. Added flags and methods to control selection/deselection of handles and anchors. Updated overlay drawing calls to match new method signatures.
editor/src/messages/tool/tool_messages/artboard_tool.rs,
.../freehand_tool.rs,
.../gradient_tool.rs,
.../line_tool.rs,
.../path_tool.rs,
.../pen_tool.rs,
.../select_tool.rs,
.../text_tool.rs
Tools updated to respect new overlay visibility settings. Overlay drawing logic refactored to use per-type checks. Added/updated tests for FreehandTool. Improved boolean operation widget construction and hover outline logic in SelectTool.
editor/src/messages/tool/transform_layer/transform_layer_message_handler.rs Overlay rendering for transform measurement now gated by visibility setting.
editor/src/messages/tool/utility_types.rs Minor formatting cleanups in tool button layout code.
libraries/math-parser/benches/bench.rs Formatting/indentation cleanup in benchmarks; no logic changes.
node-graph/README.md Example code updated to use #[soft_min(0.1)] instead of #[min(0.1)].
node-graph/gcore/src/animation.rs,
.../ops.rs,
.../raster/adjustments.rs,
.../vector/misc.rs,
.../vector/style.rs
Enums updated to use new ChoiceType derive macro with widget/label/icon metadata, replacing manual Display impls and list methods.
node-graph/gcore/src/lib.rs,
.../misc.rs
Added public Clampable trait for numeric types and DVec2, with implementations. Re-exported num_traits and added misc module.
node-graph/gcore/src/raster/color.rs Gamma correction now clamps minimum gamma value to 0.0001.
node-graph/gcore/src/registry.rs Introduced ChoiceTypeStatic trait, ChoiceWidgetHint enum, and VariantMetadata struct for enum metadata.
node-graph/gcore/src/vector/algorithms/bezpath_algorithms.rs,
.../algorithms/mod.rs
Added new module for Bézier path evaluation and sampling algorithms; exposed as public API.
node-graph/gcore/src/vector/generator_nodes.rs Numeric parameter attributes updated to use #[hard_min(...)] instead of #[min(...)].
node-graph/gcore/src/vector/vector_nodes.rs Vector node functions refactored to process all instances in tables, not just the first. Improved robustness and multi-instance support.
node-graph/graph-craft/src/document/value.rs TaggedValue macro invocation reorganized and expanded with new, categorized variants for richer type support.
node-graph/graph-craft/src/proto.rs Updated expected node IDs in a test case.
node-graph/gstd/src/filter.rs,
.../image_color_palette.rs,
.../raster.rs
Parameter attribute constraints updated: new #[hard_min(0.)] for blur radius; max_size now has #[hard_min(1.)] #[soft_max(28.)]. Formatting only in raster.rs.
node-graph/node-macro/src/codegen.rs,
.../parsing.rs,
.../validation.rs
Node macro codegen and parsing updated for soft/hard numeric bounds, with runtime clamping for hard bounds. Added validation for soft/hard min/max consistency.
node-graph/node-macro/src/derive_choice_type.rs,
.../lib.rs
New derive macro for enums: generates choice-type metadata, display, and widget integration; supports labels, icons, docstrings, and widget hints.
proc-macros/Cargo.toml Added convert_case dependency for macro label formatting.
proc-macros/src/widget_builder.rs Formatting: removed spaces after => in macro invocations.

Sequence Diagram(s)

sequenceDiagram
    participant UI
    participant DocumentHandler
    participant OverlayContext
    participant OverlaysRenderer

    UI->>DocumentHandler: SetOverlaysVisibility { visible, overlays_type }
    DocumentHandler->>OverlayContext: Update overlays_visibility_settings
    OverlayContext->>OverlaysRenderer: Provide visibility_settings
    OverlaysRenderer-->>OverlayContext: Render overlays (per-type visibility)
    OverlayContext-->>UI: Update overlay checkboxes (global & per-type)
Loading
sequenceDiagram
    participant Enum
    participant ChoiceType Derive Macro
    participant UI Widget Factory

    Enum->>ChoiceType Derive Macro: #[derive(ChoiceType)]
    ChoiceType Derive Macro->>Enum: Generate metadata, Display impl, widget hints
    UI Widget Factory->>Enum: Query ChoiceTypeStatic trait for options
    UI Widget Factory-->>UI: Build Dropdown/Radio widget for enum
Loading

Poem

Hooray for overlays, now toggled with glee,
Each type can be hidden, as granular as can be!
Enum choices now sparkle with labels and icons,
Widgets are crafted with metadata swans.
Hard and soft bounds keep numbers in check,
While Bézier paths dance with precision and tech.
🐇 A hop, a skip, for this code so neat—
More control, more clarity, a truly grand feat!

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aaa7376 and 0022680.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (52)
  • editor/src/messages/portfolio/document/document_message.rs (2 hunks)
  • editor/src/messages/portfolio/document/document_message_handler.rs (13 hunks)
  • editor/src/messages/portfolio/document/graph_operation/graph_operation_message_handler.rs (2 hunks)
  • editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs (6 hunks)
  • editor/src/messages/portfolio/document/node_graph/node_properties.rs (16 hunks)
  • editor/src/messages/portfolio/document/overlays/overlays_message_handler.rs (3 hunks)
  • editor/src/messages/portfolio/document/overlays/utility_functions.rs (2 hunks)
  • editor/src/messages/portfolio/document/overlays/utility_types.rs (5 hunks)
  • editor/src/messages/portfolio/document/utility_types/network_interface.rs (1 hunks)
  • editor/src/messages/portfolio/menu_bar/menu_bar_message_handler.rs (1 hunks)
  • editor/src/messages/tool/common_functionality/pivot.rs (7 hunks)
  • editor/src/messages/tool/common_functionality/shape_editor.rs (5 hunks)
  • editor/src/messages/tool/common_functionality/snapping.rs (1 hunks)
  • editor/src/messages/tool/common_functionality/transformation_cage.rs (2 hunks)
  • editor/src/messages/tool/tool_messages/artboard_tool.rs (1 hunks)
  • editor/src/messages/tool/tool_messages/freehand_tool.rs (1 hunks)
  • editor/src/messages/tool/tool_messages/gradient_tool.rs (2 hunks)
  • editor/src/messages/tool/tool_messages/line_tool.rs (4 hunks)
  • editor/src/messages/tool/tool_messages/path_tool.rs (2 hunks)
  • editor/src/messages/tool/tool_messages/pen_tool.rs (5 hunks)
  • editor/src/messages/tool/tool_messages/select_tool.rs (10 hunks)
  • editor/src/messages/tool/tool_messages/text_tool.rs (3 hunks)
  • editor/src/messages/tool/transform_layer/transform_layer_message_handler.rs (1 hunks)
  • editor/src/messages/tool/utility_types.rs (1 hunks)
  • editor/src/test_utils.rs (2 hunks)
  • libraries/math-parser/benches/bench.rs (1 hunks)
  • node-graph/README.md (1 hunks)
  • node-graph/gcore/src/animation.rs (1 hunks)
  • node-graph/gcore/src/lib.rs (2 hunks)
  • node-graph/gcore/src/misc.rs (1 hunks)
  • node-graph/gcore/src/ops.rs (1 hunks)
  • node-graph/gcore/src/raster/adjustments.rs (8 hunks)
  • node-graph/gcore/src/raster/color.rs (1 hunks)
  • node-graph/gcore/src/registry.rs (2 hunks)
  • node-graph/gcore/src/vector/algorithms/bezpath_algorithms.rs (1 hunks)
  • node-graph/gcore/src/vector/algorithms/mod.rs (1 hunks)
  • node-graph/gcore/src/vector/generator_nodes.rs (3 hunks)
  • node-graph/gcore/src/vector/misc.rs (3 hunks)
  • node-graph/gcore/src/vector/style.rs (4 hunks)
  • node-graph/gcore/src/vector/vector_nodes.rs (12 hunks)
  • node-graph/graph-craft/src/document/value.rs (2 hunks)
  • node-graph/graph-craft/src/proto.rs (1 hunks)
  • node-graph/gstd/src/filter.rs (1 hunks)
  • node-graph/gstd/src/image_color_palette.rs (1 hunks)
  • node-graph/gstd/src/raster.rs (1 hunks)
  • node-graph/node-macro/src/codegen.rs (6 hunks)
  • node-graph/node-macro/src/derive_choice_type.rs (1 hunks)
  • node-graph/node-macro/src/lib.rs (1 hunks)
  • node-graph/node-macro/src/parsing.rs (11 hunks)
  • node-graph/node-macro/src/validation.rs (2 hunks)
  • proc-macros/Cargo.toml (1 hunks)
  • proc-macros/src/widget_builder.rs (3 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Daniel53245 Daniel53245 merged commit e90034d into Daniel53245:master May 12, 2025
1 check was pending
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.

9 participants