Merge branch 'master' into develop
This commit is contained in:
commit
3ab2295fe7
2
src/js/controls.js
vendored
2
src/js/controls.js
vendored
@ -539,7 +539,7 @@ const controls = {
|
|||||||
|
|
||||||
// Calculate percentage
|
// Calculate percentage
|
||||||
let percent = 0;
|
let percent = 0;
|
||||||
const clientRect = this.elements.inputs.seek.getBoundingClientRect();
|
const clientRect = this.elements.progress.getBoundingClientRect();
|
||||||
const visible = `${this.config.classNames.tooltip}--visible`;
|
const visible = `${this.config.classNames.tooltip}--visible`;
|
||||||
|
|
||||||
const toggle = toggle => {
|
const toggle = toggle => {
|
||||||
|
@ -549,12 +549,30 @@ class Listeners {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Set range input alternative "value", which matches the tooltip time (#954)
|
||||||
|
on(
|
||||||
|
this.player.elements.inputs.seek,
|
||||||
|
'mousedown mousemove',
|
||||||
|
event => {
|
||||||
|
const clientRect = this.player.elements.progress.getBoundingClientRect();
|
||||||
|
const percent = 100 / clientRect.width * (event.pageX - clientRect.left);
|
||||||
|
event.currentTarget.setAttribute('seekNext', percent);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// Seek
|
// Seek
|
||||||
on(
|
on(
|
||||||
this.player.elements.inputs.seek,
|
this.player.elements.inputs.seek,
|
||||||
inputEvent,
|
inputEvent,
|
||||||
event => {
|
event => {
|
||||||
this.player.currentTime = event.target.value / event.target.max * this.player.duration;
|
const seek = event.currentTarget;
|
||||||
|
// If it exists, use seekNext instead of "value" for consistency with tooltip time (#954)
|
||||||
|
let seekTo = seek.getAttribute('seekNext');
|
||||||
|
if (utils.is.empty(seekTo)) {
|
||||||
|
seekTo = seek.value;
|
||||||
|
}
|
||||||
|
seek.removeAttribute('seekNext');
|
||||||
|
this.player.currentTime = seekTo / seek.max * this.player.duration;
|
||||||
},
|
},
|
||||||
'seek',
|
'seek',
|
||||||
);
|
);
|
||||||
|
@ -6,10 +6,15 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
margin-right: $plyr-range-thumb-height;
|
||||||
|
left: $plyr-range-thumb-height / 2;
|
||||||
|
|
||||||
input[type='range'] {
|
input[type='range'] {
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
// Offset the range thumb in order to be able to calculate the relative progress (#954)
|
||||||
|
width: calc(100% + #{$plyr-range-thumb-height}) !important;
|
||||||
|
margin: 0 -#{$plyr-range-thumb-height / 2} !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Seek tooltip to show time
|
// Seek tooltip to show time
|
||||||
|
Loading…
x
Reference in New Issue
Block a user