mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 02:01:20 -08:00
添加旋转和翻转设置
This commit is contained in:
1 parent
650d1abef3
commit
ccf1999e6d
17 files changed
+281
-60
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import { errorHandle } from '../utils';
|
||||
|
||||
export default function flipMix(art, player) {
|
||||
Object.defineProperty(player, 'flip', {
|
||||
value: dir => {
|
||||
const dirList = ['horizontal', 'vertical'];
|
||||
errorHandle(dirList.includes(dir), `The 'angle' need to be one of '[horizontal, vertical]', but got ${dir}`);
|
||||
art.refs.$player.dataset.flip = dir;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(player, 'flipRemove', {
|
||||
value: () => {
|
||||
delete art.refs.$player.dataset.flip;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -18,6 +18,8 @@ import pipMix from './pipMix';
|
||||
import loadedMix from './loadedMix';
|
||||
import playedMix from './playedMix';
|
||||
import autoSizeMix from './autoSizeMix';
|
||||
import rotateMix from './rotateMix';
|
||||
import flipMix from './flipMix';
|
||||
|
||||
export default class Player {
|
||||
constructor(art) {
|
||||
@@ -41,5 +43,7 @@ export default class Player {
|
||||
loadedMix(art, this);
|
||||
playedMix(art, this);
|
||||
autoSizeMix(art, this);
|
||||
rotateMix(art, this);
|
||||
flipMix(art, this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { errorHandle } from '../utils';
|
||||
|
||||
export default function rotateMix(art, player) {
|
||||
Object.defineProperty(player, 'rotate', {
|
||||
value: angle => {
|
||||
const angleList = [0, 90, 180, 270];
|
||||
errorHandle(angleList.includes(angle), `The 'angle' need to be one of '[0, 90, 180, 270]', but got ${angle}`);
|
||||
art.refs.$player.dataset.rotate = angle;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(player, 'rotateRemove', {
|
||||
value: () => {
|
||||
delete art.refs.$player.dataset.rotate;
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user