mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Limit slider bubble position to its track
This commit is contained in:
parent
c4824abfb0
commit
e13e6f38d5
2 changed files with 7 additions and 2 deletions
|
@ -227,7 +227,7 @@
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
transform: translate3d(-48%, -120%, 0);
|
transform: translate3d(-50%, -120%, 0);
|
||||||
background: #282828;
|
background: #282828;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
@ -48,8 +48,13 @@ define(['browser', 'dom', 'layoutManager', 'keyboardnavigation', 'css!./emby-sli
|
||||||
function updateBubble(range, value, bubble, bubbleText) {
|
function updateBubble(range, value, bubble, bubbleText) {
|
||||||
|
|
||||||
requestAnimationFrame(function () {
|
requestAnimationFrame(function () {
|
||||||
|
var bubbleTrackRect = range.sliderBubbleTrack.getBoundingClientRect();
|
||||||
|
var bubbleRect = bubble.getBoundingClientRect();
|
||||||
|
|
||||||
bubble.style.left = value + '%';
|
var bubblePos = bubbleTrackRect.width * value / 100;
|
||||||
|
bubblePos = Math.min(Math.max(bubblePos, bubbleRect.width / 2), bubbleTrackRect.width - bubbleRect.width / 2);
|
||||||
|
|
||||||
|
bubble.style.left = bubblePos + 'px';
|
||||||
|
|
||||||
if (range.getBubbleHtml) {
|
if (range.getBubbleHtml) {
|
||||||
value = range.getBubbleHtml(value);
|
value = range.getBubbleHtml(value);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue