修改绑定的键

This commit is contained in:
lyswhut
2020-04-27 11:29:23 +08:00
parent d54053003e
commit 031c0c263d
6 changed files with 47 additions and 47 deletions
+10 -10
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) {
+6 -6
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')
}
+10 -10
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) {
+10 -10
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) {
+10 -10
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) {