Revert "Any keyboard layout for Ctrl + V, Z, Y... (#763)" (#920)

This reverts commit 23796d9040.
This commit is contained in:
Chenlei Hu
2024-09-22 16:14:59 +09:00
committed by GitHub
parent 4ee1b23e9b
commit 1052603a17
2 changed files with 15 additions and 13 deletions

View File

@@ -1285,10 +1285,8 @@ export class ComfyApp {
}
if (e.type == 'keydown' && !e.repeat) {
const key = e.code
// Ctrl + M mute/unmute
if (key === 'KeyM' && (e.metaKey || e.ctrlKey)) {
if (e.key === 'm' && (e.metaKey || e.ctrlKey)) {
if (this.selected_nodes) {
for (var i in this.selected_nodes) {
if (this.selected_nodes[i].mode === 2) {
@@ -1303,7 +1301,7 @@ export class ComfyApp {
}
// Ctrl + B bypass
if (key === 'KeyB' && (e.metaKey || e.ctrlKey)) {
if (e.key === 'b' && (e.metaKey || e.ctrlKey)) {
if (this.selected_nodes) {
for (var i in this.selected_nodes) {
if (this.selected_nodes[i].mode === 4) {
@@ -1318,7 +1316,7 @@ export class ComfyApp {
}
// p pin/unpin
if (key === 'KeyP') {
if (e.key === 'p') {
if (this.selected_nodes) {
for (const i in this.selected_nodes) {
const node = this.selected_nodes[i]
@@ -1329,7 +1327,7 @@ export class ComfyApp {
}
// Alt + C collapse/uncollapse
if (key === 'KeyC' && e.altKey) {
if (e.key === 'c' && e.altKey) {
if (this.selected_nodes) {
for (var i in this.selected_nodes) {
this.selected_nodes[i].collapse()
@@ -1339,18 +1337,22 @@ export class ComfyApp {
}
// Ctrl+C Copy
if (key === 'KeyC' && (e.metaKey || e.ctrlKey)) {
if (e.key === 'c' && (e.metaKey || e.ctrlKey)) {
// Trigger onCopy
return true
}
// Ctrl+V Paste
if (key === 'KeyV' && (e.metaKey || e.ctrlKey) && !e.shiftKey) {
if (
(e.key === 'v' || e.key == 'V') &&
(e.metaKey || e.ctrlKey) &&
!e.shiftKey
) {
// Trigger onPaste
return true
}
if ((key === 'NumpadAdd' || key === 'Equal') && e.altKey) {
if (e.key === '+' && e.altKey) {
block_default = true
let scale = this.ds.scale * 1.1
this.ds.changeScale(scale, [
@@ -1360,9 +1362,9 @@ export class ComfyApp {
this.graph.change()
}
if ((key === 'NumpadSubtract' || key === 'Minus') && e.altKey) {
if (e.key === '-' && e.altKey) {
block_default = true
let scale = this.ds.scale / 1.1
let scale = (this.ds.scale * 1) / 1.1
this.ds.changeScale(scale, [
this.ds.element.width / 2,
this.ds.element.height / 2

View File

@@ -82,10 +82,10 @@ export class ChangeTracker {
async undoRedo(e) {
if (e.ctrlKey || e.metaKey) {
if (e.code === 'KeyY') {
if (e.key === 'y') {
this.updateState(this.redo, this.undo)
return true
} else if (e.code === 'KeyZ') {
} else if (e.key === 'z') {
this.updateState(this.undo, this.redo)
return true
}