-
Notifications
You must be signed in to change notification settings - Fork 436
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
Skip initial autosize transform in CompositeDrawable
#6560
base: master
Are you sure you want to change the base?
Skip initial autosize transform in CompositeDrawable
#6560
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was hoping for a more embedded solution wherein a pending autosize transform is added at the very beginning of the first update frame and can be finished immediately by the consumer calling FinishTransforms(true)
at LoadComplete
. But that'll probably be complicated to implement. Not 100% sure about this though, need opinions.
if (SkipInitialAutoSizeTransform && !didInitialAutosize) | ||
{ | ||
FinishTransforms(false, nameof(baseSize)); | ||
didInitialAutosize = true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be moved inside updateChildrenSizeDependencies
and potentially not do the transform in the first place rather than immediately terminating it? Feels weird to have laid out flat in the main update process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original thought behind placing it there was that updateChildrenSizeDependencies
can also get called from outside the update loop, so putting it here would make sure that the component had the chance to do a full update before finishing the transform.
I'm fine with moving it into updateChildrenSizeDependencies
though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up moving it into autoSizeResizeTo
instead, seemed like a more convenient place to do this to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably fine
While the problem being described here is real and has several instances of being worked around game-side, I don't like this solution and don't think it's any better than a game-side workaround. It's basically swapping a "you need to know that you have to schedule setting autosize duration/easing" to "you need to know that you have to set this one flag specific to this situation". And is there a case where you wouldn't want this flag set, even, for that matter? The ideal solution would be to somehow have
Using |
I dunno, I've mentioned elsewhere that the fact these even use transforms is wrong in my eye. Should be changed to a per-frame implementation because right now it is objectively visually wrong – each time autosize changes the duration and easing is rest causing jerkiness. I'd be against any implementation which cements transforms as being the way forward for this. |
You know that'd probably work for me too as well. Just so long as it's not one flag you have to set on $thing. As stated does this even need to be a flag? Maybe we can just force-hardcode this behaviour? |
I think I could get behind that. The case where you do want it to animate initially could be handled with a schedule-content-add-later (it seems like the edge case? although if we make the change some cases where we don't want this will likely appear). |
The original thought behind making it a flag was to make sure this doesn't cause any unexpected breakage on existing compnents. Aside from that having the initial auto-size always be instant would be my preferred solution too |
Kinda goes beyond the scope of this pr but I looked into what this could look like a bit but I don't see how this would work without giving up on I ended up hacking together a quick thing to try it out because I was curious on how well it work.
2025-04-02.17-12-03.mp4 |
I'd honestly say it's probably fine to just remove the flag and see what breaks later.
I'd rather not have a second completely parallel easing system existing in the game, so that one is a NAK as far as I'm personally concerned. |
No surprise there, I merely wanted to try it out cuz it looked interesting. I'll just remove the flag and make it the default behaviour. I'm also gonna try to look through all uses of AutoSizeDuration in lazer and see if anything looks broken to me. |
Yes, it would have to go, and be replaced with a single value that adjusts how the continuous damping is applied. There's no really good way of doing an easing selection for something like this. |
Test failure was caused by the |
CompositeDrawable
CompositeDrawable
Alright, shall I rewrite things to use this approach instead then? I'm a bit unsure if that's the final consensus here from the conversation above. |
You could give it a try and see how the resultant code looks. But others would likely have to chime in since it's going to break the API. |
Prior discussion on discord.
Adds a
SkipInitialAutoSizeTransform
property toCompositeDrawable
andContainer
to allow automatically skipping the autoSize transform when it is applied for the first time. Loosely based on howVisibilityContainer
skips it's initial hide animation usingdidInitialHide
.