From c4b5590cbefb9f4a8b664c59a9bbcd970a0da1f8 Mon Sep 17 00:00:00 2001 From: hswaminathan Date: Wed, 13 Dec 2023 14:55:46 -0500 Subject: [PATCH 1/4] fix: time tooltip truncated --- src/js/control-bar/progress-control/time-tooltip.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/js/control-bar/progress-control/time-tooltip.js b/src/js/control-bar/progress-control/time-tooltip.js index 4f01b09873..0a9d1786e2 100644 --- a/src/js/control-bar/progress-control/time-tooltip.js +++ b/src/js/control-bar/progress-control/time-tooltip.js @@ -72,9 +72,12 @@ 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); + 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; From 9e44a5164a729dc8290cb3770a27def77a831a28 Mon Sep 17 00:00:00 2001 From: hswaminathan Date: Thu, 18 Jan 2024 12:53:46 -0800 Subject: [PATCH 2/4] add comment --- src/js/control-bar/progress-control/time-tooltip.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/js/control-bar/progress-control/time-tooltip.js b/src/js/control-bar/progress-control/time-tooltip.js index 0a9d1786e2..e2617d8735 100644 --- a/src/js/control-bar/progress-control/time-tooltip.js +++ b/src/js/control-bar/progress-control/time-tooltip.js @@ -75,6 +75,11 @@ class TimeTooltip extends Component { 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; } From 3d9fad9ab659301b8a4bb4bfdeaabb2ce272df79 Mon Sep 17 00:00:00 2001 From: hswaminathan Date: Wed, 14 Feb 2024 21:18:57 +0530 Subject: [PATCH 3/4] ignore gap between seekbar and player on the right --- src/js/control-bar/progress-control/time-tooltip.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/js/control-bar/progress-control/time-tooltip.js b/src/js/control-bar/progress-control/time-tooltip.js index e2617d8735..ace4a88831 100644 --- a/src/js/control-bar/progress-control/time-tooltip.js +++ b/src/js/control-bar/progress-control/time-tooltip.js @@ -66,7 +66,8 @@ class TimeTooltip extends Component { // of the player. We calculate any gap between the left edge of the player // and the left edge of the `SeekBar` and add the number of pixels in the // `SeekBar` before hitting the `seekBarPoint` - const spaceLeftOfPoint = (seekBarRect.left - playerRect.left) + seekBarPointPx; + let spaceLeftOfPoint = (seekBarRect.left - playerRect.left) + seekBarPointPx; + // (seekBarRect.left - playerRect.left) + seekBarPointPx; // This is the space right of the `seekBarPoint` available within the bounds // of the player. We calculate the number of pixels from the `seekBarPoint` @@ -78,10 +79,11 @@ class TimeTooltip extends Component { // 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. + // In such cases, we ignore the `playerRect.right - seekBarRect.right` value when calculating. + // For the sake of consistency, we ignore seekBarRect.left - playerRect.left for the left edge. if (!spaceRightOfPoint) { spaceRightOfPoint = seekBarRect.width - seekBarPointPx; + spaceLeftOfPoint = 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`. From ce8d0ae4d089254e9ace33a66e6f195c6653a604 Mon Sep 17 00:00:00 2001 From: hswaminathan Date: Wed, 14 Feb 2024 23:44:50 +0530 Subject: [PATCH 4/4] remove comment --- src/js/control-bar/progress-control/time-tooltip.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/js/control-bar/progress-control/time-tooltip.js b/src/js/control-bar/progress-control/time-tooltip.js index ace4a88831..3a4be1e703 100644 --- a/src/js/control-bar/progress-control/time-tooltip.js +++ b/src/js/control-bar/progress-control/time-tooltip.js @@ -67,7 +67,6 @@ class TimeTooltip extends Component { // and the left edge of the `SeekBar` and add the number of pixels in the // `SeekBar` before hitting the `seekBarPoint` let spaceLeftOfPoint = (seekBarRect.left - playerRect.left) + seekBarPointPx; - // (seekBarRect.left - playerRect.left) + seekBarPointPx; // This is the space right of the `seekBarPoint` available within the bounds // of the player. We calculate the number of pixels from the `seekBarPoint`