Skip to content

Commit

Permalink
Refactor Control class to update control option variables and element…
Browse files Browse the repository at this point in the history
… references
  • Loading branch information
zhw2590582 committed Oct 21, 2024
1 parent 2eb4be2 commit cc13b9c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions docs/uncompiled/artplayer/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/uncompiled/artplayer/index.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/artplayer/src/control/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() || [];
Expand All @@ -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);
Expand Down

0 comments on commit cc13b9c

Please sign in to comment.