Skip to content

Commit

Permalink
Switch between metaKey and ctrlKey by platform (closes #307)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwbonner committed Jan 11, 2025
1 parent 5a04593 commit 5071e10
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/hub/SelectionImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ export default class SelectionImpl implements Selection {
case "ArrowLeft":
case "ArrowRight":
// Unlocked video uses arrow keys to navigate by frame
if (window.tabs.isUnlockedVideoSelected() || this.mode !== SelectionMode.Static || event.metaKey) {
if (
window.tabs.isUnlockedVideoSelected() ||
this.mode !== SelectionMode.Static ||
(window.platform === "darwin" ? event.metaKey : event.ctrlKey)
) {
return;
}

Expand Down
8 changes: 7 additions & 1 deletion src/hub/controllers/VideoController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,13 @@ export default class VideoController implements TabController {
this.SKIP_BACK_BUTTON.addEventListener("click", () => skipTime(-5));
this.SKIP_FORWARD_BUTTON.addEventListener("click", () => skipTime(5));
window.addEventListener("keydown", (event) => {
if (root === null || root.hidden || event.target !== document.body || event.metaKey) return;
if (
root === null ||
root.hidden ||
event.target !== document.body ||
(window.platform === "darwin" ? event.metaKey : event.ctrlKey)
)
return;
switch (event.code) {
case "ArrowUp":
case "ArrowDown":
Expand Down
2 changes: 1 addition & 1 deletion src/shared/renderers/ConsoleRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export default class ConsoleRenderer implements TabRenderer {
// Select filter
window.addEventListener("keydown", (event) => {
if (root === null || root.hidden || event.target !== document.body) return;
if (event.metaKey && event.key === "f") {
if ((window.platform === "darwin" ? event.metaKey : event.ctrlKey) && event.key === "f") {
this.FILTER_INPUT.select();
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/shared/renderers/ThreeDimensionRendererImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export default class ThreeDimensionRendererImpl implements TabRenderer {

// Create key bindings
window.addEventListener("keydown", (event) => {
if (event.metaKey) return;
if (window.platform === "darwin" ? event.metaKey : event.ctrlKey) return;
if (event.target !== document.body) return;
if (canvasContainer.clientHeight === 0) return;
this.keysPressed.add(event.code);
Expand Down

0 comments on commit 5071e10

Please sign in to comment.