keybooard: fix missing last key (#205)

This commit is contained in:
jean-emmanuel 2018-03-06 20:48:56 +01:00
parent 0c44e98f04
commit 974211b356
3 changed files with 12 additions and 4 deletions

View file

@ -4,6 +4,7 @@
- bug fixes
- regression preventing glass effect from using the widget's color
- missing last key in keyboard widget
- widgets
- text: set line-height relative to font size

View file

@ -163,6 +163,13 @@ This one works pretty much like the multipush, excepts it looks like a piano key
- default: `60`
- usage: MIDI note number to start with (default is C4)
!!! note ""
Standard keyboards settings are:
25 keys - start 48
49 keys - start 36
61 keys - start 36
88 keys - start 21
### `traversing`
- type: `boolean`

View file

@ -26,8 +26,8 @@ module.exports = class Keyboard extends Matrix {
_matrix: 'Matrix',
keys: 24,
start:60,
keys:25,
start:48,
traversing:true,
on:1,
off:0,
@ -54,11 +54,11 @@ module.exports = class Keyboard extends Matrix {
pattern = 'wbwbwwbwbwbw',
whiteKeys = 0, whiteKeys2 = 0, i
for (i = this.start; i < this.keys + this.start && i < 108; i++) {
for (i = this.start; i < this.keys + this.start && i < 109; i++) {
if (pattern[i % 12] == 'w') whiteKeys++
}
for (i = this.start; i < this.keys + this.start && i < 108; i++) {
for (i = this.start; i < this.keys + this.start && i < 109; i++) {
var data = JSON.parse(strData)