mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-21 21:01:20 -08:00
update aspectRatioReset
This commit is contained in:
1 parent
61cf68f0bc
commit
ad8c50ddd7
9 files changed
+91
-93
No files matched your search
@@ -7,7 +7,7 @@ export default function resizeInit(art, events) {
|
||||
if (art.normalSize) {
|
||||
art.autoSize = option.autoSize;
|
||||
}
|
||||
art.aspectRatioReset = true;
|
||||
art.aspectRatioReset();
|
||||
art.notice.show = '';
|
||||
art.emit('resize');
|
||||
}, art.constructor.RESIZE_TIME);
|
||||
|
||||
@@ -44,11 +44,9 @@ export default function aspectRatioMix(art) {
|
||||
});
|
||||
|
||||
def(art, 'aspectRatioReset', {
|
||||
set(value) {
|
||||
if (value) {
|
||||
const { aspectRatio } = art;
|
||||
art.aspectRatio = aspectRatio;
|
||||
}
|
||||
value() {
|
||||
const { aspectRatio } = art;
|
||||
art.aspectRatio = aspectRatio;
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -20,14 +20,14 @@ export default function fullscreenMix(art) {
|
||||
async set(value) {
|
||||
if (value) {
|
||||
art.normalSize = 'fullscreen';
|
||||
art.aspectRatioReset = true;
|
||||
art.aspectRatioReset();
|
||||
art.autoSize = false;
|
||||
await screenfull.request($player);
|
||||
addClass($player, 'art-fullscreen');
|
||||
art.emit('resize');
|
||||
notice.show = '';
|
||||
} else {
|
||||
art.aspectRatioReset = true;
|
||||
art.aspectRatioReset();
|
||||
art.autoSize = art.option.autoSize;
|
||||
await screenfull.exit();
|
||||
removeClass($player, 'art-fullscreen');
|
||||
|
||||
@@ -2,23 +2,26 @@ import { addClass, removeClass, hasClass, def, append } from '../utils';
|
||||
|
||||
export default function fullscreenWebMix(art) {
|
||||
const {
|
||||
option,
|
||||
notice,
|
||||
constructor,
|
||||
template: { $container, $player },
|
||||
} = art;
|
||||
|
||||
let cssText = '';
|
||||
def(art, 'fullscreenWeb', {
|
||||
get() {
|
||||
return hasClass($player, 'art-fullscreen-web');
|
||||
},
|
||||
set(value) {
|
||||
if (value) {
|
||||
cssText = $player.style.cssText;
|
||||
if (constructor.FULLSCREEN_WEB_IN_BODY) {
|
||||
append(document.body, $player);
|
||||
}
|
||||
art.normalSize = 'fullscreenWeb';
|
||||
addClass($player, 'art-fullscreen-web');
|
||||
art.aspectRatioReset = true;
|
||||
art.aspectRatioReset();
|
||||
art.autoSize = false;
|
||||
art.emit('resize');
|
||||
art.emit('fullscreenWeb', true);
|
||||
@@ -27,9 +30,13 @@ export default function fullscreenWebMix(art) {
|
||||
if (constructor.FULLSCREEN_WEB_IN_BODY) {
|
||||
append($container, $player);
|
||||
}
|
||||
if (cssText) {
|
||||
$player.style.cssText = cssText;
|
||||
cssText = '';
|
||||
}
|
||||
removeClass($player, 'art-fullscreen-web');
|
||||
art.aspectRatioReset = true;
|
||||
art.autoSize = art.option.autoSize;
|
||||
art.aspectRatioReset();
|
||||
art.autoSize = option.autoSize;
|
||||
art.emit('resize');
|
||||
art.emit('fullscreenWeb', false);
|
||||
notice.show = '';
|
||||
|
||||
@@ -5,7 +5,7 @@ export default function normalSizeMix(art) {
|
||||
|
||||
def(art, 'normalSize', {
|
||||
get() {
|
||||
return sizeProps.every((name) => !art[name]);
|
||||
return sizeProps.find((name) => art[name]) || '';
|
||||
},
|
||||
set(name) {
|
||||
sizeProps
|
||||
|
||||
@@ -2,7 +2,6 @@ import { setStyle, addClass, removeClass, hasClass } from '../utils';
|
||||
|
||||
export default function autoOrientation(art) {
|
||||
const {
|
||||
option,
|
||||
constructor,
|
||||
template: { $player, $video },
|
||||
} = art;
|
||||
@@ -28,14 +27,8 @@ export default function autoOrientation(art) {
|
||||
}
|
||||
} else {
|
||||
if (hasClass($player, 'art-auto-orientation')) {
|
||||
setStyle($player, 'width', null);
|
||||
setStyle($player, 'height', null);
|
||||
setStyle($player, 'transform', null);
|
||||
setStyle($player, 'transform-origin', null);
|
||||
removeClass($player, 'art-auto-orientation');
|
||||
art.isRotate = false;
|
||||
art.aspectRatioReset = true;
|
||||
art.autoSize = option.autoSize;
|
||||
art.notice.show = '';
|
||||
art.emit('resize');
|
||||
}
|
||||
|
||||
Vendored
+3
-1
@@ -5,7 +5,8 @@ export type Flip = 'normal' | 'horizontal' | 'vertical' | (string & Record<never
|
||||
export declare class Player {
|
||||
get aspectRatio(): AspectRatio;
|
||||
set aspectRatio(ratio: AspectRatio);
|
||||
set aspectRatioReset(state: boolean);
|
||||
get normalSize(): string;
|
||||
set normalSize(name: string);
|
||||
get playbackRate(): PlaybackRate;
|
||||
set playbackRate(rate: PlaybackRate);
|
||||
get autoSize(): boolean;
|
||||
@@ -70,4 +71,5 @@ export declare class Player {
|
||||
getBlobUrl(): Promise<string>;
|
||||
screenshot(): Promise<string>;
|
||||
airplay(): void;
|
||||
aspectRatioReset(state: boolean): void;
|
||||
}
|
||||
Reference in new issue
Block a user