Skip to content

Commit 6ce89a7

Browse files
Daniel_Alvarezqu1ck
authored andcommitted
Hotkeys link and rotate board with l/r arrows
1 parent 5af3176 commit 6ce89a7

3 files changed

Lines changed: 33 additions & 0 deletions

File tree

InteractiveHtmlBom/web/ibom.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,3 +792,14 @@ a {
792792
.column-width-handle:hover {
793793
background-color: #4f99bd;
794794
}
795+
796+
.help-link {
797+
border: 1px solid #0278a4;
798+
padding-inline: 0.3rem;
799+
border-radius: 3px;
800+
cursor: pointer;
801+
}
802+
803+
.dark .help-link {
804+
border: 1px solid #00b9fd;
805+
}

InteractiveHtmlBom/web/ibom.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
<span class="shameless-plug">
129129
<span>Created using</span>
130130
<a id="github-link" target="blank" href="https://github.com/openscopeproject/InteractiveHtmlBom">InteractiveHtmlBom</a>
131+
<a target="blank" title="Mouse and keyboard help" href="https://github.com/openscopeproject/InteractiveHtmlBom/wiki/Usage#bom-page-mouse-actions" style="text-decoration: none;"><label class="help-link">?</label></a>
131132
</span>
132133
</label>
133134
</div>

InteractiveHtmlBom/web/ibom.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,10 @@ function updateCheckboxStats(checkbox) {
10991099
td.lastChild.innerHTML = checked + "/" + total + " (" + Math.round(percent) + "%)";
11001100
}
11011101

1102+
function constrain(number, min, max){
1103+
return Math.min(Math.max(parseInt(number), min), max);
1104+
}
1105+
11021106
document.onkeydown = function (e) {
11031107
switch (e.key) {
11041108
case "n":
@@ -1119,6 +1123,23 @@ document.onkeydown = function (e) {
11191123
highlightNextRow();
11201124
e.preventDefault();
11211125
break;
1126+
case "ArrowLeft":
1127+
case "ArrowRight":
1128+
if (document.activeElement.type != "text"){
1129+
e.preventDefault();
1130+
let boardRotationElement = document.getElementById("boardRotation")
1131+
settings.boardRotation = parseInt(boardRotationElement.value); // degrees / 5
1132+
if (e.key == "ArrowLeft"){
1133+
settings.boardRotation += 3; // 15 degrees
1134+
}
1135+
else{
1136+
settings.boardRotation -= 3;
1137+
}
1138+
settings.boardRotation = constrain(settings.boardRotation, boardRotationElement.min, boardRotationElement.max);
1139+
boardRotationElement.value = settings.boardRotation
1140+
setBoardRotation(settings.boardRotation);
1141+
}
1142+
break;
11221143
default:
11231144
break;
11241145
}

0 commit comments

Comments
 (0)