update resizeInit

This commit is contained in:
Harvey Zack committed 2023-05-06 10:21:04 +08:00
1 parent 550aa0e7f2
commit 1beff2c7fa
5 files changed
+29 -14

No files matched your search

+14 -5
View File
@@ -1,13 +1,22 @@
import { throttle } from '../utils';
import { throttle, setStyle } from '../utils';
export default function resizeInit(art, events) {
const { option, constructor } = art;
const {
option,
constructor,
template: { $player },
} = art;
art.on('resize', () => {
const { aspectRatio, notice } = art;
art.aspectRatio = aspectRatio;
if (art.state === 'standard' && option.autoSize) {
art.autoSize();
if (art.state === 'standard') {
art.aspectRatio = aspectRatio;
if (option.autoSize) art.autoSize();
} else {
// TODO: 全屏时计算不准确
art.aspectRatio = 'default';
setStyle($player, 'width', null);
setStyle($player, 'height', null);
}
notice.show = '';
});
@@ -2,9 +2,9 @@ import { setStyle, def } from '../utils';
export default function aspectRatioMix(art) {
const {
template: { $video, $player },
i18n,
notice,
template: { $video, $player },
} = art;
def(art, 'aspectRatio', {
@@ -1,5 +1,4 @@
.art-fullscreen-web {
.art-fullscreen();
.art-full(var(--art-fullscreen-web-index), fixed);
width: 100% !important;
}