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

Correct fade transition when content modes differ #786

Merged
merged 1 commit into from
May 29, 2024

Conversation

ejensen
Copy link
Contributor

@ejensen ejensen commented May 28, 2024

Previously runCrossDissolveWithContentMode was adding the transitionView as a subview of the imageView and settting imageView.alpha = 0. This resulted in the image immediately disappearing since the alpha of subviews is multiplied by the alpha of super views.

This PR adds the transitionView to the superview of the imageView so the two image view's alphas are independent and properly cross-dissolve.

@ejensen ejensen marked this pull request as draft May 28, 2024 18:13
Previously runCrossDissolveWithContentMode was adding the transitionView to the imageView and settting the imageViews alpha to 0. This resulted in the image immediately disappearing since alpha of subviews are multiplied by the alpha of parent views.
Comment on lines +415 to +418
transitionView.clipsToBounds = imageView.clipsToBounds
transitionView.layer.cornerRadius = imageView.layer.cornerRadius
transitionView.layer.cornerCurve = imageView.layer.cornerCurve
transitionView.layer.maskedCorners = imageView.layer.maskedCorners
Copy link
Contributor Author

Choose a reason for hiding this comment

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

An alternative to trying to match any masking of imageView is to take a snapshot of the view before it is changed. This branch does that alternative method: main...ejensen:transition-fix-2

Copy link
Owner

Choose a reason for hiding this comment

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

Thanks for fixing it!
I don't have any strong preferences in terms of which approach to use. I assume the one from the PR was your primary choice, so I'm OK merging it as is.

@ejensen ejensen marked this pull request as ready for review May 28, 2024 19:27
@kean kean merged commit 91532c2 into kean:main May 29, 2024
7 of 8 checks passed
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.

2 participants