This commit is contained in:
syuilo 2020-09-21 11:17:04 +09:00
parent 2e4ccd8d13
commit 4167aac7dd
5 changed files with 20 additions and 14 deletions

View File

@ -5,6 +5,7 @@
"_VERSION_": false, "_VERSION_": false,
"_ENV_": false, "_ENV_": false,
"_DATA_TRANSFER_DRIVE_FILE_": false, "_DATA_TRANSFER_DRIVE_FILE_": false,
"_DATA_TRANSFER_DRIVE_FOLDER_": false "_DATA_TRANSFER_DRIVE_FOLDER_": false,
"_DATA_TRANSFER_DECK_COLUMN_": false
} }
} }

View File

@ -4,3 +4,4 @@ declare const _ENV_: string;
declare const _DEV_: boolean; declare const _DEV_: boolean;
declare const _DATA_TRANSFER_DRIVE_FILE_: string; declare const _DATA_TRANSFER_DRIVE_FILE_: string;
declare const _DATA_TRANSFER_DRIVE_FOLDER_: string; declare const _DATA_TRANSFER_DRIVE_FOLDER_: string;
declare const _DATA_TRANSFER_DECK_COLUMN_: string;

View File

@ -87,10 +87,10 @@ export default defineComponent({
keymap(): any { keymap(): any {
return { return {
'shift+up': () => this.$parent.$emit('parentFocus', 'up'), 'shift+up': () => this.$parent.$emit('parent-focus', 'up'),
'shift+down': () => this.$parent.$emit('parentFocus', 'down'), 'shift+down': () => this.$parent.$emit('parent-focus', 'down'),
'shift+left': () => this.$parent.$emit('parentFocus', 'left'), 'shift+left': () => this.$parent.$emit('parent-focus', 'left'),
'shift+right': () => this.$parent.$emit('parentFocus', 'right'), 'shift+right': () => this.$parent.$emit('parent-focus', 'right'),
}; };
} }
}, },
@ -101,21 +101,21 @@ export default defineComponent({
}, },
dragging(v) { dragging(v) {
this.$root.$emit(v ? 'deck.column.dragStart' : 'deck.column.dragEnd'); os.deckGlobalEvents.emit(v ? 'column.dragStart' : 'column.dragEnd');
} }
}, },
mounted() { mounted() {
if (!this.isMainColumn) { if (!this.isMainColumn) {
this.$root.$on('deck.column.dragStart', this.onOtherDragStart); os.deckGlobalEvents.on('column.dragStart', this.onOtherDragStart);
this.$root.$on('deck.column.dragEnd', this.onOtherDragEnd); os.deckGlobalEvents.on('column.dragEnd', this.onOtherDragEnd);
} }
}, },
beforeUnmount() { beforeUnmount() {
if (!this.isMainColumn) { if (!this.isMainColumn) {
this.$root.$off('deck.column.dragStart', this.onOtherDragStart); os.deckGlobalEvents.off('column.dragStart', this.onOtherDragStart);
this.$root.$off('deck.column.dragEnd', this.onOtherDragEnd); os.deckGlobalEvents.off('column.dragEnd', this.onOtherDragEnd);
} }
}, },
@ -234,7 +234,7 @@ export default defineComponent({
} }
e.dataTransfer.effectAllowed = 'move'; e.dataTransfer.effectAllowed = 'move';
e.dataTransfer.setData('mk-deck-column', this.column.id); e.dataTransfer.setData(_DATA_TRANSFER_DECK_COLUMN_, this.column.id);
this.dragging = true; this.dragging = true;
}, },
@ -256,7 +256,7 @@ export default defineComponent({
return; return;
} }
const isDeckColumn = e.dataTransfer.types[0] == 'mk-deck-column'; const isDeckColumn = e.dataTransfer.types[0] == _DATA_TRANSFER_DECK_COLUMN_;
e.dataTransfer.dropEffect = isDeckColumn ? 'move' : 'none'; e.dataTransfer.dropEffect = isDeckColumn ? 'move' : 'none';
@ -269,9 +269,9 @@ export default defineComponent({
onDrop(e) { onDrop(e) {
this.draghover = false; this.draghover = false;
this.$root.$emit('deck.column.dragEnd'); os.deckGlobalEvents.emit('column.dragEnd');
const id = e.dataTransfer.getData('mk-deck-column'); const id = e.dataTransfer.getData(_DATA_TRANSFER_DECK_COLUMN_);
if (id != null && id != '') { if (id != null && id != '') {
this.$store.commit('deviceUser/swapDeckColumn', { this.$store.commit('deviceUser/swapDeckColumn', {
a: this.column.id, a: this.column.id,

View File

@ -1,5 +1,6 @@
import { Component, defineAsyncComponent, markRaw, ref } from 'vue'; import { Component, defineAsyncComponent, markRaw, ref } from 'vue';
import * as PCancelable from 'p-cancelable'; import * as PCancelable from 'p-cancelable';
import { EventEmitter } from 'eventemitter3';
import Stream from '@/scripts/stream'; import Stream from '@/scripts/stream';
import { store } from '@/store'; import { store } from '@/store';
import { apiUrl } from '@/config'; import { apiUrl } from '@/config';
@ -201,3 +202,5 @@ export function sound(type: string) {
audio.volume = store.state.device.sfxVolume; audio.volume = store.state.device.sfxVolume;
audio.play(); audio.play();
} }
export const deckGlobalEvents = new EventEmitter();

View File

@ -136,6 +136,7 @@ module.exports = {
_DEV_: JSON.stringify(process.env.NODE_ENV) !== 'production', _DEV_: JSON.stringify(process.env.NODE_ENV) !== 'production',
_DATA_TRANSFER_DRIVE_FILE_: JSON.stringify('mk_drive_file'), _DATA_TRANSFER_DRIVE_FILE_: JSON.stringify('mk_drive_file'),
_DATA_TRANSFER_DRIVE_FOLDER_: JSON.stringify('mk_drive_folder'), _DATA_TRANSFER_DRIVE_FOLDER_: JSON.stringify('mk_drive_folder'),
_DATA_TRANSFER_DECK_COLUMN_: JSON.stringify('mk_deck_column'),
}), }),
new VueLoaderPlugin(), new VueLoaderPlugin(),
new WebpackOnBuildPlugin((stats: any) => { new WebpackOnBuildPlugin((stats: any) => {