Skip to content

[DYN-7843] Resize collapsed groups#16203

Merged
zeusongit merged 3 commits into
DynamoDS:masterfrom
ivaylo-matov:DYN-7843-Resize-collapsed-groups_250512
Jun 6, 2025
Merged

[DYN-7843] Resize collapsed groups#16203
zeusongit merged 3 commits into
DynamoDS:masterfrom
ivaylo-matov:DYN-7843-Resize-collapsed-groups_250512

Conversation

@ivaylo-matov

@ivaylo-matov ivaylo-matov commented May 12, 2025

Copy link
Copy Markdown
Contributor

Purpose

This PR aims to address DYN-7843

This change allows users to resize a collapsed group from the bottom-right corner, similarly to how resizing works when the group is expanded.

Please see the changes below:

  • A resize thumb has been added to the bottom-right corner of the group, visible in both expanded and collapsed states.
  • The thumb's color dynamically adjusts (white or dark grey) based on the group's background. This matches the behavior of the group title and description text.
  • By default, when collapsed:
    • The group retains the width it had when expanded.
    • The height automatically adjusts to fit all proxy ports and the node count label.
  • Once the group is manually resized while collapsed, the width and height for the collapsed state become independent of the expanded state.
  • Separate width/height adjustments are now tracked and stored for both expanded and collapsed modes.
  • Group dimensions in both states are serialized and restored when reopening a saved graph.

DYN-7843

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated
  • This PR contains no files larger than 50 MB

Release Notes

Latest changes allow users to resize groups while collapsed.

Reviewers

@DynamoDS/eidos
@jasonstratton

FYIs

@achintyabhat
@dnenov

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-7843

@jasonstratton jasonstratton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe I have been able to follow the logic and it makes sense. LGTM. Approved!

@jasonstratton

Copy link
Copy Markdown
Contributor

DynamoSelfServe failed. Attempting to run it again.
https://master-5.jenkins.autodesk.com/job/Dynamo/job/DynamoSelfServe/job/pullRequestValidation/17794/

@jasonstratton

Copy link
Copy Markdown
Contributor

It failed again. I will take a look w/ Reddy in the morning

@zeusongit zeusongit requested a review from Copilot June 2, 2025 17:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces support for resizing collapsed groups in the application by adding a bottom‐right resize thumb and tracking separate width/height adjustments for collapsed and expanded states. Key changes include adding a new thumb control style for collapsed groups, updating event handlers and layout measurement methods to support dynamic size updates, and serializing additional group adjustment properties for state restoration.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/DynamoCoreWpf/Views/Core/AnnotationView.xaml.cs Removed SizeChanged event subscriptions and added logic to handle resizing via IsVisibleChanged and DragDelta events.
src/DynamoCoreWpf/Views/Core/AnnotationView.xaml Introduced a new thumb style (GroupResizeThumbStyle) and updated layout bindings for collapsed group dimensions.
src/DynamoCoreWpf/ViewModels/Core/AnnotationViewModel.cs Added tracking of separate adjustment values for collapsed and expanded states and updated connector redraw logic.
src/DynamoCoreWpf/UI/Converters.cs Updated color conversion logic to adjust thumb foreground based on contrast ratio.
Other files (SerializationConverters.cs, PublicAPI.Unshipped.txt, WorkspaceModel.cs, AnnotationModel.cs) Extended serialization and model properties to support the new collapsed resize functionality.
Comments suppressed due to low confidence (1)

src/DynamoCoreWpf/Views/Core/AnnotationView.xaml.cs:47

  • Removing the SizeChanged event handler could potentially miss updates when the rectangle's size changes without a visibility change. Verify that relying solely on IsVisibleChanged provides consistent updates, or consider a combined approach to ensure reliability.
this.CollapsedAnnotationRectangle.SizeChanged += CollapsedAnnotationRectangle_SizeChanged;

Comment on lines +499 to +500
portControl.UpdateLayout();

Copilot AI Jun 2, 2025

Copy link

Choose a reason for hiding this comment

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

Calling UpdateLayout during drag events might impact performance if the port control contains many items; consider optimizing or caching these measurements where feasible.

Suggested change
portControl.UpdateLayout();

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ivaylo-matov This review seems relevant enough to be considered. Can you take a look and cache or limit the layout update here? This has been our focus for performance improvement, and we would like to avoid such calls, if possible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sure, will take a look

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@zeusongit , you are right.
After testing, I found that UpdateLayout() was unnecessary and have removed it.
I've also combined the two measurement methods into a single one to avoid iterating over each portControl twice.

{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var controlType = parameter as string;

Copilot AI Jun 2, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] Consider documenting the expected string values for the controlType parameter (e.g., 'Thumb') to clarify its usage for future maintainers.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've updated the XML doc summary to clarify that controlType expects a string such as "Thumb" to determine which color to use

@zeusongit zeusongit merged commit e2a8ee6 into DynamoDS:master Jun 6, 2025
27 checks passed
zeusongit added a commit to zeusongit/Dynamo that referenced this pull request Jun 11, 2025
zeusongit added a commit that referenced this pull request Jun 13, 2025
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.

4 participants