Skip to content

Commit

Permalink
reverted piano keyboard behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoenig committed Jul 24, 2024
1 parent 65d37d5 commit 99a4890
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
* widgets: added ability to switch octaves in the piano keyboard widget, thanks, ego-lay-atman-bay!
* gui: added credits for ego-lay-atman-bay
* v10-rc6
* reverted piano keyboard behavior

### 2024-07-22
* edited help screen for doDeleteBlock, converted to PNG, reduced file size
Expand Down
24 changes: 20 additions & 4 deletions src/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -3692,15 +3692,15 @@ PianoMenuMorph.prototype.processKeyDown = function (event) {
case 40: // 'down arrow'
case 189: // -
return event.shiftKey ?
this.octaveUp()
: this.octaveDown();
this.octaveDown()
: this.selectDown();
case 38: // 'up arrow'
case 39: // 'right arrow'
case 187: // +
case 220: // #
return event.shiftKey ?
this.octaveDown()
: this.octaveUp();
this.octaveUp()
: this.selectUp();
default:
switch(event.key) {
case 'c':
Expand Down Expand Up @@ -3739,6 +3739,22 @@ PianoMenuMorph.prototype.processKeyDown = function (event) {
}
};

PianoMenuMorph.prototype.selectUp = function () {
this.selectKey(
this.selection ?
Math.min(this.selection.action + 1, 143)
: 1
);
};

PianoMenuMorph.prototype.selectDown = function () {
this.selectKey(
this.selection ?
Math.max(this.selection.action - 1, 0)
: 1
);
};

PianoMenuMorph.prototype.octaveUp = function () {
this.octave += this.visibleOctaves;
this.octave = Math.min(this.octave, 10 - (11) % this.visibleOctaves);
Expand Down

0 comments on commit 99a4890

Please sign in to comment.