feat: Add getRect function to utils and update player and control modules to use it

This commit is contained in:
Harvey Zack committed 2024-06-08 12:17:45 +08:00
1 parent 2721f61b41
commit 232b8a3e17
10 files changed
+36 -27

No files matched your search

+3 -3
View File
@@ -1,4 +1,4 @@
import { setStyles, includeFromEvent, isMobile } from '../utils';
import { setStyles, includeFromEvent, isMobile, getRect } from '../utils';
import Component from '../utils/component';
import playbackRate from './playbackRate';
import aspectRatio from './aspectRatio';
@@ -86,8 +86,8 @@ export default class Contextmenu extends Component {
const mouseX = event.clientX;
const mouseY = event.clientY;
const { height: cHeight, width: cWidth, left: cLeft, top: cTop } = $player.getBoundingClientRect();
const { height: mHeight, width: mWidth } = $contextmenu.getBoundingClientRect();
const { height: cHeight, width: cWidth, left: cLeft, top: cTop } = getRect($player);
const { height: mHeight, width: mWidth } = getRect($contextmenu);
let menuLeft = mouseX - cLeft;
let menuTop = mouseY - cTop;