mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-22 05:11:20 -08:00
Refactor Control class to update control option variables and element references
This commit is contained in:
1 parent
2eb4be2bbe
commit
cc13b9cc0f
3 files changed
+7
-7
No files matched your search
@@ -266,14 +266,14 @@ export default class Control extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
const setLeft = () => {
|
||||
const resize = () => {
|
||||
const refWidth = getStyle($ref, 'width');
|
||||
const listWidth = getStyle($list, 'width');
|
||||
const left = refWidth / 2 - listWidth / 2;
|
||||
$list.style.left = `${left}px`;
|
||||
};
|
||||
|
||||
hover($ref, setLeft);
|
||||
hover($ref, resize);
|
||||
|
||||
const event = proxy($list, 'click', async (event) => {
|
||||
const path = event.composedPath() || [];
|
||||
@@ -284,7 +284,7 @@ export default class Control extends Component {
|
||||
if (option.onSelect) {
|
||||
$value.innerHTML = await option.onSelect.call(this.art, find, $item, event);
|
||||
}
|
||||
setLeft();
|
||||
resize();
|
||||
});
|
||||
|
||||
events.push(event);
|
||||
|
||||
Reference in new issue
Block a user