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: solve the smooth scrolling scene, the y value obtained is the data 100ms ago #1439

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

xujiujiu
Copy link
Contributor

@xujiujiu xujiujiu commented Apr 7, 2024

In the smooth scrolling scene on the mobile phone, the y value obtained by the monitored scroll event is too small, causing the bottom content to be invisible during playback.

Copy link

changeset-bot bot commented Apr 7, 2024

⚠️ No Changeset found

Latest commit: c04104d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@xujiujiu xujiujiu closed this Apr 7, 2024
@xujiujiu xujiujiu reopened this Apr 7, 2024
@xujiujiu
Copy link
Contributor Author

xujiujiu commented Apr 7, 2024

When listening to the scroll event, the x and y data of the node cannot be obtained because the target cannot be obtained through throttle

@xujiujiu
Copy link
Contributor Author

xujiujiu commented Apr 7, 2024

image

@xujiujiu
Copy link
Contributor Author

xujiujiu commented Apr 7, 2024

image there target is undefined

...arg,
target: arg.target
}
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this argument transformation something specific to MouseEvent/TouchEvent/DragEvent ?

I think this needs a bit more explanation; the T type here is supposed to be generic, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm still wondering why we need to do the transformation?
is it that an explicit reference to the target needs to be saved before the timeout?
I would have thought that args being in a closure should handle saving the reference?

timeout = null;
func.apply(context, args);
if (timeout) {
clearTimeout(timeout)
Copy link
Contributor

Choose a reason for hiding this comment

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

I can't see why you need to clear the timeout here as it is a 'one-shot' timeout.
clearing it would make sense if it was setInterval, but it seems to me that it's already been called and won't be called again?
Is there some concurrency or similar here that is possible?

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.

None yet

2 participants