Make second mouse button send dit on dah key

For #43
This commit is contained in:
Neale Pickett 2022-05-04 18:50:24 -06:00
parent 5c39fef446
commit af21b30afc
2 changed files with 13 additions and 7 deletions

View File

@ -173,19 +173,19 @@
</td>
<td>
<img class="gamepad b2" title="Gamepad Left Button" src="b2.svg" alt="Left Button">
<kbd class="gamepad" title="Gamepad Left Shoulder Button">LB</kbd>
<kbd class="gamepad" title="Gamepad Left Shoulder Button">L1</kbd>
</td>
<td>
<i class="material-icons" role="presentation">gamepad</i>
</td>
<td>
<img class="gamepad b3" title="Gamepad Top Button" src="b3.svg" alt="Top Button">
<kbd class="gamepad" title="Gamepad Right Shoulder Button">RB</kbd>
<kbd class="gamepad" title="Gamepad Right Shoulder Button">R1</kbd>
</td>
</tr>
<tr>
<td colspan="4" class="mdl-card__supporting-text" style="text-align: center;">
Second mouse button: Dah
Second mouse button switches dah and dit
</td>
</tr>
</table>

View File

@ -29,11 +29,17 @@ export class HTML extends Input{
let begin = event.type.endsWith("down") || event.type.endsWith("start")
if (event.target.id == "dah") {
this.keyer.Dah(begin)
} else if ((event.target.id == "dit") && (event.button == 2)) {
this.keyer.Dah(begin)
if (event.button == 2) {
this.keyer.Dit(begin)
} else {
this.keyer.Dah(begin)
}
} else if (event.target.id == "dit") {
this.keyer.Dit(begin)
if (event.button == 2) {
this.keyer.Dah(begin)
} else {
this.keyer.Dit(begin)
}
} else if (event.target.id == "key") {
this.keyer.Straight(begin)
} else {