Skip to content

Commit

Permalink
Merge pull request #186 from HyeokjinKang/editor-new-hotkey-250124
Browse files Browse the repository at this point in the history
feat: νƒ€μž„ μ‹œκ·Έλ‹ˆμ³ λ³€ν™˜ 및 ν™•λŒ€/μΆ•μ†Œ 단좕킀 μΆ”κ°€
  • Loading branch information
HyeokjinKang authored Jan 24, 2025
2 parents b42d32b + 7274051 commit f3fb5ef
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 14 deletions.
32 changes: 22 additions & 10 deletions public/js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2441,18 +2441,28 @@ const test = () => {
ctrlDown = false;
};

const changeSplit = () => {
const changeSplit = (isTriggeredByKey) => {
split++;
if (split == 5) {
split = 6;
} else if (split == 7) {
split = 8;
} else if (split == 9) {
split = 12;
} else if (split == 13) {
split = 16;
} else if (split == 17) {
split = 1;
} else if (split > 8) {
if (isTriggeredByKey) {
if (split == 9) {
split = 12;
} else if (split == 13) {
split = 16;
} else if (split == 17) {
split = 24;
} else if (split == 25) {
split = 32;
} else {
split = 1;
}
} else {
split = 1;
}
}
document.getElementById("split").innerText = `1/${split}`;
};
Expand Down Expand Up @@ -2915,8 +2925,6 @@ document.onkeyup = (e) => {
ctrlDown = false;
} else if (e.key == "Shift") {
shiftDown = false;
} else if (e.code == "Slash") {
hideHelp();
}
};

Expand Down Expand Up @@ -2994,13 +3002,17 @@ document.onkeydown = (e) => {
elementPaste();
}
} else if (e.code == "Slash") {
showHelp();
changeSplit(true);
} else if (e.code == "KeyG") {
toggleGrid();
} else if (e.code == "KeyT") {
toggleMagnet();
} else if (e.code == "KeyB") {
toggleMetronome();
} else if (e.code == "Minus") {
zoomOut();
} else if (e.code == "Equal") {
zoomIn();
}
}
if (mode == 2) {
Expand Down
16 changes: 12 additions & 4 deletions views/editor.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
</div>
<div class="helpBoxSpliter">
<div class="helpKeyContainer">
<span class="helpKey"><kbd>?</kbd></span>
<span class="helpDescription">Help</span>
<span class="helpKey"><kbd class="ctrl">Ctrl</kbd> + <kbd>P</kbd></span>
<span class="helpDescription">Test</span>
</div>
<div class="helpKeyContainer">
<span class="helpKey"><kbd class="ctrl">Ctrl</kbd> + <kbd>C</kbd></span>
Expand Down Expand Up @@ -117,8 +117,16 @@
<span class="helpDescription">Change Element</span>
</div>
<div class="helpKeyContainer">
<span class="helpKey"><kbd class="ctrl">Ctrl</kbd> + <kbd>P</kbd></span>
<span class="helpDescription">Test</span>
<span class="helpKey"><kbd>/</kbd></span>
<span class="helpDescription">Time Signature</span>
</div>
<div class="helpKeyContainer">
<span class="helpKey"><kbd>-</kbd></span>
<span class="helpDescription">Zoom Out</span>
</div>
<div class="helpKeyContainer">
<span class="helpKey"><kbd>+</kbd></span>
<span class="helpDescription">Zoom In</span>
</div>
</div>
</div>
Expand Down

0 comments on commit f3fb5ef

Please sign in to comment.