-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Added disableAnimator method so we can disable constraint animator proxy... #189
base: master
Are you sure you want to change the base?
Added disableAnimator method so we can disable constraint animator proxy... #189
Conversation
…oxy when no longer needed.
Good point, I hadn't thought of that How about If we created a this means that any calls to
Thus meaning the following would work
|
closing due to inactivity |
Sorry for the inactivity. Could we re-open this now so I can work on this again? :-) I'm curious why you'd prefer to wrap the I'd have a preference for not wrapping it because I don't want to have to create a new constraint, store a reference to it, destroy the new constraint and then restore the old reference every time I need to animate a constraint. That feels bug-prone and costly to me. I'm open to input though, so let me know what you think please. Do you object to turning off the animator proxy? It seemed like the natural complement to turning it on. Please let me know. I'm happy to help. And thanks for creating and maintaining Masonry - I really appreciate you doing this even though more attention might be on SnapKit in Swift. |
I think for consistency ie
I think using composition instead of a useAnimator variable is much more elegant as it leaves the original constraint unchanged and therefore removes the weird side effect of setting |
@cloudkite thanks for re-opening. Let me take a look at composition and get back to you ... |
@iosdev-republicofapps I guess another way of approaching this could be to
This is a much simpler change than composition. However it doesn't completely get rid of the side effect but it's alot less complicated so might be good enough. |
... when no longer needed.
We need to be able to disable the animator proxy when it's no longer needed. This is necessary because we may have a sequence like:
So we need to be able to turn off the animator proxy as needed. As the
animator
property is currently implemented onMASConstraint
, it permanently enables the animator. We need to be able to disable the animator on a given constraint object without having to destroy/rebuild/remove/remake that constraint.All this PR does is reverse the enabling of the animator proxy on a constraint. To use the proxy again, the caller just needs to use the animator property again on the constraint and it will be re-enabled.
The cost of doing this is infinitesimally small: all we're doing is setting and unsetting a single boolean.
This is currently a blocking bug for me so the sooner we could get this merged into a release that would be ideal. :-) I am very happy to help in any way that I can - please don't hesitate to ask.
All tests pass after this change.