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

Fix the calc cursor handle being offset during animated scroll #10778

Closed

Conversation

Cwiiis
Copy link
Contributor

@Cwiiis Cwiiis commented Dec 19, 2024

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.

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
@caolanm caolanm force-pushed the private/cwiiis/fix-calc-handle-offset-on-scroll branch from 68a65c6 to 58774eb Compare December 19, 2024 19:30
@@ -2082,13 +2082,16 @@ class CanvasSectionContainer {
this.continueAnimating = false;
}

const section: CanvasSectionObject = this.getSectionWithName(this.getAnimatingSectionName());
Copy link
Contributor

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:)

Copy link
Contributor Author

@Cwiiis Cwiiis Dec 20, 2024

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.

Copy link
Contributor Author

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).

Copy link
Contributor

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 Cwiiis requested a review from gokaysatir December 20, 2024 10:06
@gokaysatir
Copy link
Contributor

gokaysatir commented Dec 20, 2024

@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.

Copy link
Contributor

@gokaysatir gokaysatir left a 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 :)

@eszkadev
Copy link
Contributor

eszkadev commented Jan 9, 2025

the other PR was merged to solve issue, can we close this one?

@eszkadev eszkadev added the draft label Jan 9, 2025
@eszkadev eszkadev closed this Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Cell handle appears offset while scrolling in Calc
3 participants