mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 06:31:20 -08:00
fix setting style
This commit is contained in:
1 parent
7aad1936c2
commit
a52d5c92c0
3 files changed
+241
-229
No files matched your search
@@ -351,11 +351,17 @@ export default class Setting extends Component {
|
||||
} = this.art;
|
||||
|
||||
if (controls.setting && !isMobile) {
|
||||
const settingWidth = width || constructor.SETTING_WIDTH;
|
||||
const { left: controlLeft, width: controlWidth } = controls.setting.getBoundingClientRect();
|
||||
const { left: playerlLeft } = $player.getBoundingClientRect();
|
||||
const settingLeft = controlLeft - playerlLeft + controlWidth / 2 - (width || constructor.SETTING_WIDTH) / 2;
|
||||
setStyle($setting, 'left', `${settingLeft}px`);
|
||||
setStyle($setting, 'right', 'auto');
|
||||
const { left: playerLeft, width: playerWidth } = $player.getBoundingClientRect();
|
||||
const settingLeft = controlLeft - playerLeft + controlWidth / 2 - settingWidth / 2;
|
||||
if (settingLeft + settingWidth > playerWidth) {
|
||||
setStyle($setting, 'left', 'auto');
|
||||
setStyle($setting, 'right', '10px');
|
||||
} else {
|
||||
setStyle($setting, 'left', `${settingLeft}px`);
|
||||
setStyle($setting, 'right', 'auto');
|
||||
}
|
||||
} else {
|
||||
setStyle($setting, 'left', 'auto');
|
||||
setStyle($setting, 'right', '10px');
|
||||
|
||||
Reference in new issue
Block a user