fix: wrong play bar behavior when dragging or clicking, #166.

This commit is contained in:
Terry Geng 2020-06-05 14:07:48 +08:00
parent ebbacf652e
commit 92b3a3c7be
No known key found for this signature in database
GPG Key ID: F982F8EA1DF720E7
2 changed files with 3 additions and 3 deletions

View File

@ -64,7 +64,7 @@ class ReverseProxied(object):
web = Flask(__name__)
web.config['TEMPLATES_AUTO_RELOAD'] = True
#web.config['TEMPLATES_AUTO_RELOAD'] = True
log = logging.getLogger("bot")
user = 'Remote Control'

View File

@ -1072,13 +1072,13 @@ playerBarBox.addEventListener('mousedown', function () {
});
playerBarBox.addEventListener('mouseup', function (event) {
playerBarBox.removeEventListener('mousemove', playheadDragged);
let percent = event.offsetX / playerBarBox.clientWidth;
let percent = (event.clientX - playerBarBox.getBoundingClientRect().x) / playerBarBox.clientWidth;
request('post', {move_playhead: percent * currentPlayingItem.duration});
playhead_dragging = false;
});
function playheadDragged(event){
let percent = event.offsetX / playerBarBox.clientWidth;
let percent = (event.clientX - playerBarBox.getBoundingClientRect().x) / playerBarBox.clientWidth;
setProgressBar(playerBar, percent, secondsToStr(percent * currentPlayingItem.duration));
}