-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
improve: Better mouse position handling #5773
Conversation
💖 Thanks for opening this pull request! 💖 Things that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
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.
And more discussion over in slack :)
Hey @gkatsev, do you have any comment on this one? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
It's been a while. Seems to be working fine. Would be great if we can figure out how to fix mobile but this is an improvement still. I'll figure out how to fix the conflict and merge. |
Oops, the commit has the wrong issue number. |
Fixed it. |
From my understand, in the changes #5773, the Y position of all the boxes is already calculated and accounted for in the offsetY value we get. However, because the HTML coordinate system has Y=0 at the top, when we do offsetY/boxH, we get a position relative to the top of the element. However, we expect that position relative to the "start" of the slider, or the bottom of it. Therefore, we want to get the inverse value, which is '1 - clamp(offsetY/boxH)'. Fixes #6863
From my understand, in the changes #5773, the Y position of all the boxes is already calculated and accounted for in the offsetY value we get. However, because the HTML coordinate system has Y=0 at the top, when we do offsetY/boxH, we get a position relative to the top of the element. However, we expect that position relative to the "start" of the slider, or the bottom of it. Therefore, we want to get the inverse value, which is '1 - clamp(offsetY/boxH)'. Fixes #6863
This uses offsetX and offsetY on the MouseEvents which helps account for transforms on the player. Unfortunately, this isn't available on TouchEvents, so, while this helps desktop devices with using a mouse, it doesn't help mobile devices using touch. Fixes videojs#6726, fixes videojs#1102.
From my understand, in the changes videojs#5773, the Y position of all the boxes is already calculated and accounted for in the offsetY value we get. However, because the HTML coordinate system has Y=0 at the top, when we do offsetY/boxH, we get a position relative to the top of the element. However, we expect that position relative to the "start" of the slider, or the bottom of it. Therefore, we want to get the inverse value, which is '1 - clamp(offsetY/boxH)'. Fixes videojs#6863
Description
It is an enhancement for mouse position handling, this will fix the issues when you scale the elements using
transform
instead of the default font-size scaling provided by videojs, it will work since we will use the local offset position of an element.Specific Changes proposed
transform:scale
elements without worrying that the position will change drastically.offset
of the inner elements, such asvjs-load-progress
and such.Requirements Checklist