Skip to content

Commit

Permalink
Resolved timeline command conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
amyjko committed Oct 21, 2023
1 parent 0dc8a84 commit 8c81227
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
24 changes: 11 additions & 13 deletions src/components/editor/util/Commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ export const StepBackNode: Command = {
description: (l) => l.ui.timeline.button.backNode,
visible: Visibility.Visible,
category: Category.Evaluate,
shift: false,
alt: false,
shift: true,
alt: true,
control: true,
key: 'ArrowLeft',
keySymbol: '←',
Expand All @@ -285,8 +285,8 @@ export const StepForwardNode: Command = {
category: Category.Evaluate,
key: 'ArrowRight',
keySymbol: '→',
shift: false,
alt: false,
shift: true,
alt: true,
control: true,
active: (context) => context.caret?.isNode() ?? false,
execute: (context) =>
Expand Down Expand Up @@ -319,25 +319,23 @@ export const StepToStart: Command = {
description: (l) => l.ui.timeline.button.start,
visible: Visibility.Visible,
category: Category.Evaluate,
shift: true,
alt: true,
shift: false,
alt: false,
control: true,
key: 'ArrowLeft',
keySymbol: '←',
key: 'Home',
active: (context) => !context.evaluator.isAtBeginning(),
execute: (context) => context.evaluator.stepTo(0),
};

export const StepToPresent: Command = {
symbol: '⇥',
description: (l) => l.ui.timeline.button.forwardInput,
description: (l) => l.ui.timeline.button.present,
visible: Visibility.Visible,
category: Category.Evaluate,
shift: true,
alt: true,
shift: false,
alt: false,
control: true,
key: 'ArrowRight',
keySymbol: '⇢',
key: 'End',
active: (context) => context.evaluator.isInPast(),
execute: (context) => context.evaluator.stepToEnd(),
};
Expand Down
3 changes: 2 additions & 1 deletion src/components/widgets/CommandHint.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
const modifiers = getKeyboardModifiers();
</script>

{#if $modifiers && ((command.control && $modifiers.control) || (command.shift && $modifiers.shift) || (command.alt && $modifiers.alt))}<div
<!-- Show the hint if any modifier is pressed and the pattern of modifier keys pressed partially matches this command -->
{#if $modifiers && Object.values($modifiers).some((val) => val === true) && ((command.control && $modifiers.control) || (command.shift && command.shift) || (command.alt && $modifiers.alt)) && !((command.control === false && $modifiers.control) || (command.shift && $modifiers.shift) || (command.alt && $modifiers.alt))}<div
class="hint"
role="presentation"
>{toShortcut(
Expand Down
2 changes: 1 addition & 1 deletion src/locale/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -3907,7 +3907,7 @@
"forwardStep": "step forward one",
"forwardNode": "step forward to next node evaluation",
"forwardInput": "step forward to next stream input",
"present": "to the present",
"present": "to the end",
"start": "to the beginning",
"reset": "restart performance"
}
Expand Down

0 comments on commit 8c81227

Please sign in to comment.