diff options
Diffstat (limited to 'src/js/controls.js')
-rw-r--r-- | src/js/controls.js | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/js/controls.js b/src/js/controls.js index f414f6d6..953ca293 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -9,7 +9,20 @@ import support from './support'; import { repaint, transitionEndEvent } from './utils/animation'; import { dedupe } from './utils/arrays'; import browser from './utils/browser'; -import { createElement, emptyElement, getAttributesFromSelector, getElement, getElements, hasClass, matches, removeElement, setAttributes, setFocus, toggleClass, toggleHidden } from './utils/elements'; +import { + createElement, + emptyElement, + getAttributesFromSelector, + getElement, + getElements, + hasClass, + matches, + removeElement, + setAttributes, + setFocus, + toggleClass, + toggleHidden, +} from './utils/elements'; import { off, on } from './utils/events'; import i18n from './utils/i18n'; import is from './utils/is'; @@ -667,7 +680,7 @@ const controls = { } // Set CSS custom property - range.style.setProperty('--value', `${range.value / range.max * 100}%`); + range.style.setProperty('--value', `${(range.value / range.max) * 100}%`); }, // Update hover tooltip for seeking @@ -699,7 +712,7 @@ const controls = { // Determine percentage, if already visible if (is.event(event)) { - percent = 100 / clientRect.width * (event.pageX - clientRect.left); + percent = (100 / clientRect.width) * (event.pageX - clientRect.left); } else if (hasClass(this.elements.display.seekTooltip, visible)) { percent = parseFloat(this.elements.display.seekTooltip.style.left, 10); } else { @@ -714,7 +727,7 @@ const controls = { } // Display the time a click would seek to - controls.updateTimeDisplay.call(this, this.elements.display.seekTooltip, this.duration / 100 * percent); + controls.updateTimeDisplay.call(this, this.elements.display.seekTooltip, (this.duration / 100) * percent); // Set position this.elements.display.seekTooltip.style.left = `${percent}%`; @@ -1674,15 +1687,17 @@ const controls = { .filter(Boolean) .forEach(button => { if (is.array(button) || is.nodeList(button)) { - Array.from(button).filter(Boolean).forEach(addProperty); + Array.from(button) + .filter(Boolean) + .forEach(addProperty); } else { addProperty(button); } }); } - // Edge sometimes doesn't finish the paint so force a redraw - if (window.navigator.userAgent.includes('Edge')) { + // Edge sometimes doesn't finish the paint so force a repaint + if (browser.isEdge) { repaint(target); } |