mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 06:31: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
@@ -8,6 +8,7 @@ import {
|
||||
def,
|
||||
has,
|
||||
append,
|
||||
getRect,
|
||||
addClass,
|
||||
setStyle,
|
||||
isMobile,
|
||||
@@ -399,8 +400,8 @@ export default class Setting extends Component {
|
||||
|
||||
if (controls.setting && !isMobile) {
|
||||
const settingWidth = width || constructor.SETTING_WIDTH;
|
||||
const { left: controlLeft, width: controlWidth } = controls.setting.getBoundingClientRect();
|
||||
const { left: playerLeft, width: playerWidth } = $player.getBoundingClientRect();
|
||||
const { left: controlLeft, width: controlWidth } = getRect(controls.setting);
|
||||
const { left: playerLeft, width: playerWidth } = getRect($player);
|
||||
const settingLeft = controlLeft - playerLeft + controlWidth / 2 - settingWidth / 2;
|
||||
if (settingLeft + settingWidth > playerWidth) {
|
||||
setStyle($setting, 'left', null);
|
||||
|
||||
Reference in new issue
Block a user