mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 23:51:20 -08:00
优化画面调整
This commit is contained in:
1 parent
5cbb8bd1f3
commit
7e4420d841
5 files changed
+119
-119
No files matched your search
@@ -1,25 +1,37 @@
|
||||
import { errorHandle, def } from '../utils';
|
||||
|
||||
export default function flipMix(art, player) {
|
||||
const { $player } = art.template;
|
||||
const {
|
||||
template: { $player },
|
||||
i18n,
|
||||
notice,
|
||||
} = art;
|
||||
|
||||
def(player, 'flip', {
|
||||
get() {
|
||||
return $player.dataset.flip;
|
||||
},
|
||||
set(flip) {
|
||||
if (flip) {
|
||||
const flipList = ['normal', 'horizontal', 'vertical'];
|
||||
errorHandle(flipList.includes(flip), `'flip' only accept ${flipList.toString()} as parameters`);
|
||||
player.rotate = 0;
|
||||
if (flip === 'normal') {
|
||||
player.flip = false;
|
||||
} else {
|
||||
$player.dataset.flip = flip;
|
||||
art.emit('flip', flip);
|
||||
}
|
||||
} else {
|
||||
const flipList = [false, 'normal', 'horizontal', 'vertical'];
|
||||
errorHandle(flipList.includes(flip), `'flip' only accept ${flipList.toString()} as parameters`);
|
||||
|
||||
if (!flip || flip === 'normal') {
|
||||
delete $player.dataset.flip;
|
||||
art.emit('flip', 'normal');
|
||||
} else {
|
||||
$player.dataset.flip = flip;
|
||||
}
|
||||
|
||||
const word = flip.replace(flip[0], flip[0].toUpperCase());
|
||||
notice.show = `${i18n.get('Flip')}: ${i18n.get(word)}`;
|
||||
art.emit('flip', flip);
|
||||
},
|
||||
});
|
||||
|
||||
def(player, 'flipReset', {
|
||||
set(value) {
|
||||
if (value && player.flip) {
|
||||
const { flip } = player;
|
||||
player.flip = flip;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user