@@ -1283,8 +1283,10 @@ export class ComfyApp {
1283
1283
}
1284
1284
1285
1285
if ( e . type == 'keydown' && ! e . repeat ) {
1286
+ const key = e . code
1287
+
1286
1288
// Ctrl + M mute/unmute
1287
- if ( e . key === 'm ' && ( e . metaKey || e . ctrlKey ) ) {
1289
+ if ( key === 'KeyM ' && ( e . metaKey || e . ctrlKey ) ) {
1288
1290
if ( this . selected_nodes ) {
1289
1291
for ( var i in this . selected_nodes ) {
1290
1292
if ( this . selected_nodes [ i ] . mode === 2 ) {
@@ -1299,7 +1301,7 @@ export class ComfyApp {
1299
1301
}
1300
1302
1301
1303
// Ctrl + B bypass
1302
- if ( e . key === 'b ' && ( e . metaKey || e . ctrlKey ) ) {
1304
+ if ( key === 'KeyB ' && ( e . metaKey || e . ctrlKey ) ) {
1303
1305
if ( this . selected_nodes ) {
1304
1306
for ( var i in this . selected_nodes ) {
1305
1307
if ( this . selected_nodes [ i ] . mode === 4 ) {
@@ -1314,7 +1316,7 @@ export class ComfyApp {
1314
1316
}
1315
1317
1316
1318
// p pin/unpin
1317
- if ( e . key === 'p ' ) {
1319
+ if ( key === 'KeyP ' ) {
1318
1320
if ( this . selected_nodes ) {
1319
1321
for ( const i in this . selected_nodes ) {
1320
1322
const node = this . selected_nodes [ i ]
@@ -1325,7 +1327,7 @@ export class ComfyApp {
1325
1327
}
1326
1328
1327
1329
// Alt + C collapse/uncollapse
1328
- if ( e . key === 'c ' && e . altKey ) {
1330
+ if ( key === 'KeyC ' && e . altKey ) {
1329
1331
if ( this . selected_nodes ) {
1330
1332
for ( var i in this . selected_nodes ) {
1331
1333
this . selected_nodes [ i ] . collapse ( )
@@ -1335,22 +1337,22 @@ export class ComfyApp {
1335
1337
}
1336
1338
1337
1339
// Ctrl+C Copy
1338
- if ( e . key === 'c ' && ( e . metaKey || e . ctrlKey ) ) {
1340
+ if ( key === 'KeyC ' && ( e . metaKey || e . ctrlKey ) ) {
1339
1341
// Trigger onCopy
1340
1342
return true
1341
1343
}
1342
1344
1343
1345
// Ctrl+V Paste
1344
1346
if (
1345
- ( e . key === 'v' || e . key == 'V ') &&
1347
+ ( key === 'KeyV ' ) &&
1346
1348
( e . metaKey || e . ctrlKey ) &&
1347
1349
! e . shiftKey
1348
1350
) {
1349
1351
// Trigger onPaste
1350
1352
return true
1351
1353
}
1352
1354
1353
- if ( e . key === '+' && e . altKey ) {
1355
+ if ( ( key === 'NumpadAdd' || key === 'Equal' ) && e . altKey ) {
1354
1356
block_default = true
1355
1357
let scale = this . ds . scale * 1.1
1356
1358
this . ds . changeScale ( scale , [
@@ -1360,9 +1362,9 @@ export class ComfyApp {
1360
1362
this . graph . change ( )
1361
1363
}
1362
1364
1363
- if ( e . key === '-' && e . altKey ) {
1365
+ if ( ( key === 'NumpadSubtract' || key === 'Minus' ) && e . altKey ) {
1364
1366
block_default = true
1365
- let scale = ( this . ds . scale * 1 ) / 1.1
1367
+ let scale = this . ds . scale / 1.1
1366
1368
this . ds . changeScale ( scale , [
1367
1369
this . ds . element . width / 2 ,
1368
1370
this . ds . element . height / 2
0 commit comments