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 precise-volume hud positioning #567

Merged
merged 1 commit into from
Feb 6, 2022

Conversation

Araxeus
Copy link
Collaborator

@Araxeus Araxeus commented Jan 22, 2022

This change was needed for 2 reasons:

  • Video.clientHeight update delay on srcChanged event:
    video.addEventListener('srcChanged', videoStarted);

    the following code was supposed to position the hud, but video.clientHeight was 0 (because it wasn't updated yet)
    volumeHud.style.top = showVideo ? `${(player.clientHeight - video.clientHeight) / 2}px` : 0;

    fixed by setting a tiny delay (250ms) before changing the hud position

  • hud sometimes mispositioned when video-toggle is off:
    the active hud positioning was only inside the video-toggle plugin, so I moved it to the precise-volume plugin.
    now if video-toggle is enabled - it will handle all hud positioning, and if it isn't, then precise-volume will handle it itself

@Araxeus Araxeus force-pushed the fix-precise-volume-hud-position branch from b468dea to 02081d8 Compare January 27, 2022 20:41
Copy link
Owner

@th-ch th-ch left a comment

Choose a reason for hiding this comment

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

Looks ok, thanks for the improvement! ✅

@th-ch th-ch merged commit d785b9b into th-ch:master Feb 6, 2022
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.

2 participants