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: time tooltip truncated #8527

Merged
merged 4 commits into from
Apr 10, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/js/control-bar/progress-control/time-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,17 @@ class TimeTooltip extends Component {
// of the player. We calculate the number of pixels from the `seekBarPoint`
// to the right edge of the `SeekBar` and add to that any gap between the
// right edge of the `SeekBar` and the player.
const spaceRightOfPoint = (seekBarRect.width - seekBarPointPx) +
let spaceRightOfPoint = (seekBarRect.width - seekBarPointPx) +
(playerRect.right - seekBarRect.right);

// spaceRightOfPoint is always NaN for mouse time display
// because the seekbarRect does not have a right property. This causes
// the mouse tool tip to be truncated when it's close to the right edge of the player.
// In such cases, we ignore the `playerRect.right - seekBarRect.right` value when calculating
// spaceRightofPoint.
if (!spaceRightOfPoint) {
spaceRightOfPoint = seekBarRect.width - seekBarPointPx;
}
// This is the number of pixels by which the tooltip will need to be pulled
// further to the right to center it over the `seekBarPoint`.
let pullTooltipBy = tooltipRect.width / 2;
Expand Down