mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 08:01:20 -08:00
使用 e.pageX
This commit is contained in:
1 parent
581b453ed2
commit
896de568cc
4 files changed
+5
-5
No files matched your search
@@ -7,7 +7,7 @@ export function getPosFromEvent(art, event) {
|
||||
} = art;
|
||||
|
||||
const { left } = $progress.getBoundingClientRect();
|
||||
const width = clamp(event.x - left, 0, $progress.clientWidth);
|
||||
const width = clamp(event.pageX - left, 0, $progress.clientWidth);
|
||||
const second = (width / $progress.clientWidth) * player.duration;
|
||||
const time = secondToTime(second);
|
||||
const percentage = clamp(width / $progress.clientWidth, 0, 1);
|
||||
|
||||
@@ -23,7 +23,7 @@ export default function volume(controlOption) {
|
||||
const { left: panelLeft, width: panelWidth } = $volumePanel.getBoundingClientRect();
|
||||
const { width: handleWidth } = $volumeHandle.getBoundingClientRect();
|
||||
const percentage =
|
||||
clamp(event.x - panelLeft - handleWidth / 2, 0, panelWidth - handleWidth / 2) /
|
||||
clamp(event.pageX - panelLeft - handleWidth / 2, 0, panelWidth - handleWidth / 2) /
|
||||
(panelWidth - handleWidth);
|
||||
return percentage;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user