mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-17 18:11:20 -08:00
25 lines
645 B
JavaScript
25 lines
645 B
JavaScript
import { throttle } from '../utils';
|
|
|
|
export default function resizeInit(art, events) {
|
|
const { notice, option } = art;
|
|
|
|
const resizeFn = throttle(() => {
|
|
if (art.normalSize) {
|
|
art.autoSize = option.autoSize;
|
|
}
|
|
art.aspectRatioReset = true;
|
|
notice.show = '';
|
|
art.emit('resize');
|
|
}, art.constructor.RESIZE_TIME);
|
|
|
|
events.proxy(window, ['orientationchange', 'resize'], () => {
|
|
resizeFn();
|
|
});
|
|
|
|
if (screen && screen.orientation && screen.orientation.onchange) {
|
|
events.proxy(screen.orientation, 'change', () => {
|
|
resizeFn();
|
|
});
|
|
}
|
|
}
|