添加旋转和翻转设置

This commit is contained in:
Harvey Zack committed 2018-11-09 16:58:21 +08:00
1 parent 650d1abef3
commit ccf1999e6d
17 files changed
+281 -60

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
import { append, inverseClass } from '../utils';
export default class Flip {
constructor(option) {
this.option = option;
}
apply(art, $setting) {
const { i18n, events: { proxy }, player } = art;
this.$header = $setting.querySelector('.art-setting-header');
this.$body = append($setting, `
<div class="art-setting-body">
<span class="art-setting-btn" data-flip="horizontal">${i18n.get('Horizontal')}</span>
<span class="art-setting-btn" data-flip="vertical">${i18n.get('Vertical')}</span>
</div>
`);
proxy(this.$body, 'click', event => {
const { target } = event;
const { flip } = target.dataset;
if (flip) {
player.flip(flip);
inverseClass(target, 'current');
}
});
}
}