修改绑定的键

pull/225/head
lyswhut 2020-04-27 11:29:23 +08:00
parent d54053003e
commit 031c0c263d
6 changed files with 47 additions and 47 deletions

View File

@ -19,7 +19,7 @@
### 更变
- 下载列表的歌曲下载、播放将随设置中的保存路径改变而改变,不再固定指向其初始位置
- 移除列表多选框,现在多选需要键盘配合,想要多选前需按下`Shift`或`Alt`键然后再鼠标点击想要选中的内容即可触发多选机制,其中`Shift`键用于连续选择,`Alt`键用于不连续选择,`Ctrl+a`用于快速全选。例子一想要选中1-5项则先按下`Shift`键后鼠标点击第一项再点击第五项即可完成选择例子二想要选中1项与第3项则先按下`Alt`键后,鼠标点击第一项,再点击第三项即可完成选择;例子三:想要选中当前列表的全部内容,键盘先按下`Ctrl`键不放,然后按`a`键,即可完成选择。用`Shift`或`Alt`选择时,鼠标点击未选中的内容会将其选中,点击已选择的内容会将其取消选择,若想全部取消选择,在不按`Shift`或`Alt`键的情况下,随意点击列表里的一项内容即可全部取消选择。
- 移除列表多选框,现在多选需要键盘配合,想要多选前需按下`Shift`或`Ctrl`键然后再鼠标点击想要选中的内容即可触发多选机制,其中`Shift`键用于连续选择,`Ctrl`键用于不连续选择,`Ctrl+a`用于快速全选。例子一想要选中1-5项则先按下`Shift`键后鼠标点击第一项再点击第五项即可完成选择例子二想要选中1项与第3项则先按下`Ctrl`键后,鼠标点击第一项,再点击第三项即可完成选择;例子三:想要选中当前列表的全部内容,键盘先按下`Ctrl`键不放,然后按`a`键,即可完成选择。用`Shift`或`Ctrl`选择时,鼠标点击未选中的内容会将其选中,点击已选择的内容会将其取消选择,若想全部取消选择,在不按`Shift`或`Alt`键的情况下,随意点击列表里的一项内容即可全部取消选择。(P.S`Ctrl`键对应Mac OS上的`Command`键)
### 修复

View File

@ -123,7 +123,7 @@ export default {
selectdList: [],
keyEvent: {
isShiftDown: false,
isAltDown: false,
isModDown: false,
isADown: false,
},
}
@ -138,16 +138,16 @@ export default {
listenEvent() {
window.eventHub.$on('shift_down', this.handle_shift_down)
window.eventHub.$on('shift_up', this.handle_shift_up)
window.eventHub.$on('alt_down', this.handle_alt_down)
window.eventHub.$on('alt_up', this.handle_alt_up)
window.eventHub.$on('mod_down', this.handle_mod_down)
window.eventHub.$on('mod_up', this.handle_mod_up)
window.eventHub.$on('mod+a_down', this.handle_mod_a_down)
window.eventHub.$on('mod+a_up', this.handle_mod_a_up)
},
unlistenEvent() {
window.eventHub.$off('shift_down', this.handle_shift_down)
window.eventHub.$off('shift_up', this.handle_shift_up)
window.eventHub.$off('alt_down', this.handle_alt_down)
window.eventHub.$off('alt_up', this.handle_alt_up)
window.eventHub.$off('mod_down', this.handle_mod_down)
window.eventHub.$off('mod_up', this.handle_mod_up)
window.eventHub.$off('mod+a_down', this.handle_mod_a_down)
window.eventHub.$off('mod+a_up', this.handle_mod_a_up)
},
@ -157,11 +157,11 @@ export default {
handle_shift_up() {
if (this.keyEvent.isShiftDown) this.keyEvent.isShiftDown = false
},
handle_alt_down() {
if (!this.keyEvent.isAltDown) this.keyEvent.isAltDown = true
handle_mod_down() {
if (!this.keyEvent.isModDown) this.keyEvent.isModDown = true
},
handle_alt_up() {
if (this.keyEvent.isAltDown) this.keyEvent.isAltDown = false
handle_mod_up() {
if (this.keyEvent.isModDown) this.keyEvent.isModDown = false
},
handle_mod_a_down() {
if (!this.keyEvent.isADown) {
@ -214,7 +214,7 @@ export default {
event.currentTarget.classList.add('active')
this.selectdList.push(this.list[clickIndex])
}
} else if (this.keyEvent.isAltDown) {
} else if (this.keyEvent.isModDown) {
let item = this.list[clickIndex]
let index = this.selectdList.indexOf(item)
if (index < 0) {

View File

@ -11,12 +11,12 @@ const bindKey = () => {
eventHub.$emit('shift_up', { event, combo })
return false
}, 'keyup')
mousetrap.bind('alt', (event, combo) => {
eventHub.$emit('alt_down', { event, combo })
mousetrap.bind('mod', (event, combo) => {
eventHub.$emit('mod_down', { event, combo })
return false
}, 'keydown')
mousetrap.bind('alt', (event, combo) => {
eventHub.$emit('alt_up', { event, combo })
mousetrap.bind('mod', (event, combo) => {
eventHub.$emit('mod_up', { event, combo })
return false
}, 'keyup')
mousetrap.bind('mod+a', (event, combo) => {
@ -32,8 +32,8 @@ const bindKey = () => {
const unbindKey = () => {
mousetrap.unbind('shift', 'keydown')
mousetrap.unbind('shift', 'keyup')
mousetrap.unbind('alt', 'keydown')
mousetrap.unbind('alt', 'keyup')
mousetrap.unbind('mod', 'keydown')
mousetrap.unbind('mod', 'keyup')
mousetrap.unbind('mod+a', 'keydown')
mousetrap.unbind('mod+a', 'keyup')
}

View File

@ -72,7 +72,7 @@ export default {
tabId: 'all',
keyEvent: {
isShiftDown: false,
isAltDown: false,
isModDown: false,
isADown: false,
},
}
@ -132,16 +132,16 @@ export default {
listenEvent() {
window.eventHub.$on('shift_down', this.handle_shift_down)
window.eventHub.$on('shift_up', this.handle_shift_up)
window.eventHub.$on('alt_down', this.handle_alt_down)
window.eventHub.$on('alt_up', this.handle_alt_up)
window.eventHub.$on('mod_down', this.handle_mod_down)
window.eventHub.$on('mod_up', this.handle_mod_up)
window.eventHub.$on('mod+a_down', this.handle_mod_a_down)
window.eventHub.$on('mod+a_up', this.handle_mod_a_up)
},
unlistenEvent() {
window.eventHub.$off('shift_down', this.handle_shift_down)
window.eventHub.$off('shift_up', this.handle_shift_up)
window.eventHub.$off('alt_down', this.handle_alt_down)
window.eventHub.$off('alt_up', this.handle_alt_up)
window.eventHub.$off('mod_down', this.handle_mod_down)
window.eventHub.$off('mod_up', this.handle_mod_up)
window.eventHub.$off('mod+a_down', this.handle_mod_a_down)
window.eventHub.$off('mod+a_up', this.handle_mod_a_up)
},
@ -151,11 +151,11 @@ export default {
handle_shift_up() {
if (this.keyEvent.isShiftDown) this.keyEvent.isShiftDown = false
},
handle_alt_down() {
if (!this.keyEvent.isAltDown) this.keyEvent.isAltDown = true
handle_mod_down() {
if (!this.keyEvent.isModDown) this.keyEvent.isModDown = true
},
handle_alt_up() {
if (this.keyEvent.isAltDown) this.keyEvent.isAltDown = false
handle_mod_up() {
if (this.keyEvent.isModDown) this.keyEvent.isModDown = false
},
handle_mod_a_down() {
if (!this.keyEvent.isADown) {
@ -229,7 +229,7 @@ export default {
event.currentTarget.classList.add('active')
this.selectdData.push(this.showList[clickIndex])
}
} else if (this.keyEvent.isAltDown) {
} else if (this.keyEvent.isModDown) {
let item = this.showList[clickIndex]
let index = this.selectdData.indexOf(item)
if (index < 0) {

View File

@ -70,7 +70,7 @@ export default {
isToggleList: true,
keyEvent: {
isShiftDown: false,
isAltDown: false,
isModDown: false,
isADown: false,
},
}
@ -193,16 +193,16 @@ export default {
listenEvent() {
window.eventHub.$on('shift_down', this.handle_shift_down)
window.eventHub.$on('shift_up', this.handle_shift_up)
window.eventHub.$on('alt_down', this.handle_alt_down)
window.eventHub.$on('alt_up', this.handle_alt_up)
window.eventHub.$on('mod_down', this.handle_mod_down)
window.eventHub.$on('mod_up', this.handle_mod_up)
window.eventHub.$on('mod+a_down', this.handle_mod_a_down)
window.eventHub.$on('mod+a_up', this.handle_mod_a_up)
},
unlistenEvent() {
window.eventHub.$off('shift_down', this.handle_shift_down)
window.eventHub.$off('shift_up', this.handle_shift_up)
window.eventHub.$off('alt_down', this.handle_alt_down)
window.eventHub.$off('alt_up', this.handle_alt_up)
window.eventHub.$off('mod_down', this.handle_mod_down)
window.eventHub.$off('mod_up', this.handle_mod_up)
window.eventHub.$off('mod+a_down', this.handle_mod_a_down)
window.eventHub.$off('mod+a_up', this.handle_mod_a_up)
},
@ -212,11 +212,11 @@ export default {
handle_shift_up() {
if (this.keyEvent.isShiftDown) this.keyEvent.isShiftDown = false
},
handle_alt_down() {
if (!this.keyEvent.isAltDown) this.keyEvent.isAltDown = true
handle_mod_down() {
if (!this.keyEvent.isModDown) this.keyEvent.isModDown = true
},
handle_alt_up() {
if (this.keyEvent.isAltDown) this.keyEvent.isAltDown = false
handle_mod_up() {
if (this.keyEvent.isModDown) this.keyEvent.isModDown = false
},
handle_mod_a_down() {
if (!this.keyEvent.isADown) {
@ -311,7 +311,7 @@ export default {
event.currentTarget.classList.add('active')
this.selectdData.push(this.list[clickIndex])
}
} else if (this.keyEvent.isAltDown) {
} else if (this.keyEvent.isModDown) {
let item = this.list[clickIndex]
let index = this.selectdData.indexOf(item)
if (index < 0) {

View File

@ -80,7 +80,7 @@ export default {
isShowListAddMultiple: false,
keyEvent: {
isShiftDown: false,
isAltDown: false,
isModDown: false,
isADown: false,
},
}
@ -171,16 +171,16 @@ export default {
listenEvent() {
window.eventHub.$on('shift_down', this.handle_shift_down)
window.eventHub.$on('shift_up', this.handle_shift_up)
window.eventHub.$on('alt_down', this.handle_alt_down)
window.eventHub.$on('alt_up', this.handle_alt_up)
window.eventHub.$on('mod_down', this.handle_mod_down)
window.eventHub.$on('mod_up', this.handle_mod_up)
window.eventHub.$on('mod+a_down', this.handle_mod_a_down)
window.eventHub.$on('mod+a_up', this.handle_mod_a_up)
},
unlistenEvent() {
window.eventHub.$off('shift_down', this.handle_shift_down)
window.eventHub.$off('shift_up', this.handle_shift_up)
window.eventHub.$off('alt_down', this.handle_alt_down)
window.eventHub.$off('alt_up', this.handle_alt_up)
window.eventHub.$off('mod_down', this.handle_mod_down)
window.eventHub.$off('mod_up', this.handle_mod_up)
window.eventHub.$off('mod+a_down', this.handle_mod_a_down)
window.eventHub.$off('mod+a_up', this.handle_mod_a_up)
},
@ -190,11 +190,11 @@ export default {
handle_shift_up() {
if (this.keyEvent.isShiftDown) this.keyEvent.isShiftDown = false
},
handle_alt_down() {
if (!this.keyEvent.isAltDown) this.keyEvent.isAltDown = true
handle_mod_down() {
if (!this.keyEvent.isModDown) this.keyEvent.isModDown = true
},
handle_alt_up() {
if (this.keyEvent.isAltDown) this.keyEvent.isAltDown = false
handle_mod_up() {
if (this.keyEvent.isModDown) this.keyEvent.isModDown = false
},
handle_mod_a_down() {
if (!this.keyEvent.isADown) {
@ -276,7 +276,7 @@ export default {
event.currentTarget.classList.add('active')
this.selectdData.push(this.listInfo.list[clickIndex])
}
} else if (this.keyEvent.isAltDown) {
} else if (this.keyEvent.isModDown) {
let item = this.listInfo.list[clickIndex]
let index = this.selectdData.indexOf(item)
if (index < 0) {