Skip to content

Commit

Permalink
Added simple hotkeys for existing control buttons.
Browse files Browse the repository at this point in the history
  • Loading branch information
fkurmannucsc authored Jun 27, 2024
1 parent 2547e6b commit ca1aabf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
6 changes: 3 additions & 3 deletions static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ <h1>Shark Clipper</h1>
</div>

<div class='page-section control-area'>
<button onclick='toggleSelection()'>Toggle Selection Box</button>
<button onclick='captureFrame()'>Take Screenshot</button>
<button onclick='save()'>Save Screenshots</button>
<button onclick='toggleSelection()'>Toggle Selection Box (B)</button>
<button onclick='captureFrame()'>Take Screenshot (F)</button>
<button onclick='save()'>Save Screenshots (S)</button>
</div>

<div class='page-section screenshot-area'>
Expand Down
14 changes: 14 additions & 0 deletions static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,22 @@ function fetchVersion() {
});
}

// Initialize hotkey functionality.
function initializeHotkeys() {
document.addEventListener('keydown', (event) => {
if (event.code === 'KeyB') {
toggleSelection();
} else if (event.code === 'KeyF') {
captureFrame();
} else if (event.code === 'KeyS') {
save();
}
});
}

function main() {
fetchVersion();
initializeHotkeys();
goToUploadScreen();
}

Expand Down

0 comments on commit ca1aabf

Please sign in to comment.