Skip to content

Commit

Permalink
fix UX issues in move debugger (#640)
Browse files Browse the repository at this point in the history
* fix UX issues in move debugger

* fix(debug): Don’t toggle debugger pane while debugger is hidden

* fix(debug): Don’t activate move hotkey if Ctrl/Cmd key is pressed

Co-authored-by: delucis <swithinbank@gmail.com>
  • Loading branch information
nicolodavis and delucis authored May 2, 2020
1 parent dc668ec commit 1483a08
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/client/debug/Debug.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@
let visible = true;
function Keypress(e) {
// Toggle debugger visibilty
if (e.key == '.') {
visible = !visible;
return;
}
// Set displayed pane
if (!visible) return;
Object.entries(panes).forEach(([key, { shortcut }]) => {
if (e.key == shortcut) {
pane = key;
Expand Down
6 changes: 5 additions & 1 deletion src/client/debug/main/Hotkey.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
}
function Keypress(e) {
if (!$disableHotkeys && !disable && e.key == value) {
if (
!$disableHotkeys && !disable &&
!e.ctrlKey && !e.metaKey &&
e.key == value
) {
e.preventDefault();
Activate();
}
Expand Down
10 changes: 8 additions & 2 deletions src/client/debug/main/InteractiveFunction.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@

<style>
.move {
display: flex;
flex-direction: row;
cursor: pointer;
margin-left: 10px;
color: #666;
Expand All @@ -69,10 +71,14 @@
</style>

<div class="move" class:active on:click={Activate}>
{name}(<span
<span>{name}</span>
<span>(</span>
<span
class="arg-field"
bind:this={span}
on:blur={Deactivate}
on:keypress|stopPropagation={() => {}}
on:keydown={OnKeyDown}
contentEditable />)
contentEditable />
<span>)</span>
</div>

0 comments on commit 1483a08

Please sign in to comment.