Skip to content
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

Ryken100/attached card shadow composition mask brush resize fix #4588

Conversation

Ryken100
Copy link

@Ryken100 Ryken100 commented Jun 28, 2022

Fixes #4587

This PR fixes an issue where when AttachedCardShadow.InnerContentClipType is set to CompositionMaskBrush, the shadow doesn't properly resize when the element it's attached to changes size. It also fixes an issue where if InnerContentClipType is set to CompositionMaskBrush then back to CompositionGeometricClip, resizing gets broken in the CompositionGeometricClip mode as well.

PR Type

What kind of change does this PR introduce?

Bugfix

What is the current behavior?

When AttachedCardShadow.InnerContentClipType == CompositionMaskBrush, the sizes of the masked SpriteVisual, and the SpriteVisual that owns the shadow were not updated when the attached FrameworkElement changes size. Additionally, AttachedShadowElementContext.SpriteVisual.Size and RelativeSizeAdjustment values were not reset to default when InnerContentClipType changed from CompositionMaskBrush to CompositionGeometricClip.

What is the new behavior?

When AttachedCardShadow.InnerContentClipType == CompositionMaskBrush, the sizes of the masked SpriteVisual, and the SpriteVisual are now updated when the attached FrameworkElement changes size. Additionally, AttachedShadowElementContext.SpriteVisual.Size and RelativeSizeAdjustment are reset to default when AttachedCardShadow.InnerContentClipType == CompositionGeometricClip, preventing potential resize issues.

PR Checklist

Please check if your PR fulfills the following requirements:

  • Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
  • Based off latest main branch of toolkit
  • Tested code with current supported SDKs
  • Contains NO breaking changes

Other information

@ghost
Copy link

ghost commented Jun 28, 2022

Thanks Ryken100 for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌

@ghost ghost requested review from michael-hawker and azchohfi June 28, 2022 21:57
@ghost ghost added the bug 🐛 An unexpected issue that highlights incorrect behavior label Jun 28, 2022
@michael-hawker michael-hawker added this to the 7.1.3 milestone Jul 14, 2022
Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

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

Tested in the sample app, worked like a charm!

@michael-hawker michael-hawker merged commit 0864016 into CommunityToolkit:main Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior hotfix 🌶
Projects
None yet
4 participants