-
Notifications
You must be signed in to change notification settings - Fork 734
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
Fix the calc cursor handle being offset during animated scroll #10778
Conversation
Introduce an onAnimationStep callback for animating canvas objects so they can run animation logic outside of the drawing callgraph. Use this for scroll animations in ScrollSection. Signed-off-by: Chris Lord <[email protected]> Change-Id: I1d4e774247e8ff80b285b2bd8d2079c90b4a2a71
68a65c6
to
58774eb
Compare
@@ -2082,13 +2082,16 @@ class CanvasSectionContainer { | |||
this.continueAnimating = false; | |||
} | |||
|
|||
const section: CanvasSectionObject = this.getSectionWithName(this.getAnimatingSectionName()); |
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 think we don't need to add this. onDraw function is called on animation steps. It looks like moving the last if block to the top of onDraw function would do the same thing (in ScrollSection.ts)? Maybe we can find a way withouth adding this function. Thanks for checking the issue:)
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.
This wouldn't do the same thing - this is moving the altering of scroll position outside of the middle of the drawing chain. The problem isn't fixed by altering the scroll position before drawing the scrollbars. The scroll position has external dependents and needs to be changed before drawing begins, not in the middle of it.
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 other thing we could do is add an onBeforeDraw
function, I suppose - the result would be the same, although the impact would be slightly greater (it's negligible either way, but this way, only animated containers are affected, if we add an onBeforeDraw
, every container will be affected, animating or not).
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 think this also requires: Removal of (frameCount?: number, elapsedTime?: number)
from onDraw function variables, for a better API design. We don't have to do this now but i guess that would be better, since we separate the drawing and before-drawing phases.
Let me check drawingOrder and processingOrder variables first. They should indicate the wrong order of processing, about external dependents of scroll section.
Even if we can solve this without new callback, this idea is better i think. Will check this and other PR in a bit. Thanks :)
@Cwiiis i guess this issue appeared after recent works on scroll section. I'd expect to see this issue earlier even before improvements on scroll section though. Anyway, this is about drawing orders of sections, can we use something like in below PR for now, if it has no downsides? We can of course add animation step if we encounter something that we can't solve using current features. |
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.
We had a solution playing with the drawing and processing orders. Let's keep this out for now. And thanks for investigating the issue :)
the other PR was merged to solve issue, can we close this one? |
Introduce an onAnimationStep callback for animating canvas objects so they can run animation logic outside of the drawing callgraph. Use this for scroll animations in ScrollSection.