mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 16:11:20 -08:00
feat: Add getRect function to utils and update player and control modules to use it
This commit is contained in:
1 parent
2721f61b41
commit
232b8a3e17
10 files changed
+36
-27
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { append, setStyle, isMobile } from '../utils';
|
||||
import { append, setStyle, isMobile, getRect } from '../utils';
|
||||
|
||||
export default function volume(option) {
|
||||
return (art) => ({
|
||||
@@ -17,7 +17,7 @@ export default function volume(option) {
|
||||
const $indicator = append($slider, `<div class="art-volume-indicator"></div>`);
|
||||
|
||||
function getVolumeFromEvent(event) {
|
||||
const { top, height } = $slider.getBoundingClientRect();
|
||||
const { top, height } = getRect($slider);
|
||||
return 1 - (event.clientY - top) / height;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user