Use ⌘ key on macOS instead of Ctrl
This commit is contained in:
parent
55c17f5760
commit
11c6d47935
26
src/main.js
26
src/main.js
|
|
@ -1698,28 +1698,29 @@ window.addEventListener("keydown", (e) => {
|
||||||
// TODO
|
// TODO
|
||||||
// }
|
// }
|
||||||
// console.log(e)
|
// console.log(e)
|
||||||
|
let mod = macOS ? e.metaKey : e.ctrlKey;
|
||||||
if (e.key == config.shortcuts.playAnimation) {
|
if (e.key == config.shortcuts.playAnimation) {
|
||||||
console.log("Spacebar pressed")
|
console.log("Spacebar pressed")
|
||||||
playPause()
|
playPause()
|
||||||
} else if (e.key == config.shortcuts.new && e.ctrlKey == true) {
|
} else if (e.key == config.shortcuts.new && mod == true) {
|
||||||
newFile()
|
newFile()
|
||||||
} else if (e.key == config.shortcuts.save && e.ctrlKey == true) {
|
} else if (e.key == config.shortcuts.save && mod == true) {
|
||||||
save()
|
save()
|
||||||
} else if (e.key == config.shortcuts.saveAs && e.ctrlKey == true) {
|
} else if (e.key == config.shortcuts.saveAs && mod == true) {
|
||||||
saveAs()
|
saveAs()
|
||||||
} else if (e.key == config.shortcuts.open && e.ctrlKey == true) {
|
} else if (e.key == config.shortcuts.open && mod == true) {
|
||||||
open()
|
open()
|
||||||
} else if (e.key == config.shortcuts.quit && e.ctrlKey == true) {
|
} else if (e.key == config.shortcuts.quit && mod == true) {
|
||||||
quit()
|
quit()
|
||||||
} else if (e.key == config.shortcuts.undo && e.ctrlKey == true) {
|
} else if (e.key == config.shortcuts.undo && mod == true) {
|
||||||
undo()
|
undo()
|
||||||
} else if (e.key == config.shortcuts.redo && e.ctrlKey == true) {
|
} else if (e.key == config.shortcuts.redo && mod == true) {
|
||||||
redo()
|
redo()
|
||||||
} else if (e.key == config.shortcuts.group && e.ctrlKey == true) {
|
} else if (e.key == config.shortcuts.group && mod == true) {
|
||||||
actions.group.create()
|
actions.group.create()
|
||||||
}
|
}
|
||||||
else if (e.key == "ArrowRight") {
|
else if (e.key == "ArrowRight") {
|
||||||
if (e.ctrlKey == true) {
|
if (mod == true) {
|
||||||
advanceFrame()
|
advanceFrame()
|
||||||
} else if (context.selection) {
|
} else if (context.selection) {
|
||||||
context.activeObject.currentFrame.saveState()
|
context.activeObject.currentFrame.saveState()
|
||||||
|
|
@ -1732,7 +1733,7 @@ window.addEventListener("keydown", (e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
}
|
}
|
||||||
else if (e.key == "ArrowLeft") {
|
else if (e.key == "ArrowLeft") {
|
||||||
if (e.ctrlKey == true) {
|
if (mod == true) {
|
||||||
decrementFrame()
|
decrementFrame()
|
||||||
} else if (context.selection) {
|
} else if (context.selection) {
|
||||||
context.activeObject.currentFrame.saveState()
|
context.activeObject.currentFrame.saveState()
|
||||||
|
|
@ -1745,7 +1746,7 @@ window.addEventListener("keydown", (e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
}
|
}
|
||||||
else if (e.key == "ArrowUp") {
|
else if (e.key == "ArrowUp") {
|
||||||
if (e.ctrlKey == true) {
|
if (mod == true) {
|
||||||
// no action yet for ctrl+up
|
// no action yet for ctrl+up
|
||||||
} else if (context.selection) {
|
} else if (context.selection) {
|
||||||
context.activeObject.currentFrame.saveState()
|
context.activeObject.currentFrame.saveState()
|
||||||
|
|
@ -1758,7 +1759,7 @@ window.addEventListener("keydown", (e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
}
|
}
|
||||||
else if (e.key == "ArrowDown") {
|
else if (e.key == "ArrowDown") {
|
||||||
if (e.ctrlKey == true) {
|
if (mod == true) {
|
||||||
// no action yet for ctrl+down
|
// no action yet for ctrl+down
|
||||||
} else if (context.selection) {
|
} else if (context.selection) {
|
||||||
context.activeObject.currentFrame.saveState()
|
context.activeObject.currentFrame.saveState()
|
||||||
|
|
@ -3025,7 +3026,6 @@ async function updateMenu() {
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
console.log(Submenu)
|
|
||||||
const helpSubmenu = await Submenu.new({
|
const helpSubmenu = await Submenu.new({
|
||||||
text: "Help",
|
text: "Help",
|
||||||
items: [
|
items: [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue