mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 02:01:20 -08:00
update
This commit is contained in:
1 parent
d8e0a53b99
commit
00150073b9
4 files changed
+191
-73
No files matched your search
@@ -1,42 +0,0 @@
|
||||
import { addClass, removeClass, hasClass, def, setStyle } from '../utils';
|
||||
|
||||
export default function fullscreenRotateMix(art, player) {
|
||||
const { $container, $player } = art.template;
|
||||
|
||||
def(player, 'fullscreenRotate', {
|
||||
get() {
|
||||
return hasClass($container, 'art-fullscreen-rotate');
|
||||
},
|
||||
set: (value) => {
|
||||
if (value) {
|
||||
addClass($container, 'art-fullscreen-rotate');
|
||||
player.autoSize = true;
|
||||
const { clientHeight: bodyHeight, clientWidth: bodyWidth } = document.body;
|
||||
const { clientHeight: playerHeight, clientWidth: playerWidth } = $player;
|
||||
const bodyRatio = bodyWidth / bodyHeight;
|
||||
const videoRatio = playerWidth / playerHeight;
|
||||
const needSpin = bodyRatio < videoRatio;
|
||||
if (needSpin) {
|
||||
const scale = Math.min(bodyHeight / playerWidth, bodyWidth / playerHeight).toFixed(2);
|
||||
setStyle($player, 'transform', `rotate(90deg) scale(${scale},${scale})`);
|
||||
art.emit('resize');
|
||||
art.emit('fullscreenRotate', true);
|
||||
}
|
||||
} else {
|
||||
removeClass($container, 'art-fullscreen-rotate');
|
||||
player.autoSize = art.option.autoSize;
|
||||
setStyle($player, 'transform', null);
|
||||
art.emit('resize');
|
||||
art.emit('fullscreenRotate');
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
def(player, 'fullscreenRotateToggle', {
|
||||
set(value) {
|
||||
if (value) {
|
||||
player.fullscreenRotate = !player.fullscreenRotate;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -15,7 +15,6 @@ import aspectRatioMix from './aspectRatioMix';
|
||||
import screenshotMix from './screenshotMix';
|
||||
import fullscreenMix from './fullscreenMix';
|
||||
import fullscreenWebMix from './fullscreenWebMix';
|
||||
import fullscreenRotateMix from './fullscreenRotateMix';
|
||||
import pipMix from './pipMix';
|
||||
import loadedMix from './loadedMix';
|
||||
import playedMix from './playedMix';
|
||||
@@ -48,7 +47,6 @@ export default class Player {
|
||||
screenshotMix(art, this);
|
||||
fullscreenMix(art, this);
|
||||
fullscreenWebMix(art, this);
|
||||
fullscreenRotateMix(art, this);
|
||||
pipMix(art, this);
|
||||
loadedMix(art, this);
|
||||
playedMix(art, this);
|
||||
|
||||
Reference in new issue
Block a user