From 974211b35640bf2a5c20cc9fa9195b0905af4a2e Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 6 Mar 2018 20:48:56 +0100 Subject: [PATCH] keybooard: fix missing last key (#205) --- CHANGELOG.md | 1 + resources/docs/widgets/matrices.md | 7 +++++++ src/browser/js/app/widgets/matrices/keyboard.js | 8 ++++---- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9557bcf..bd15ef15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/resources/docs/widgets/matrices.md b/resources/docs/widgets/matrices.md index 400f46b3..f4a1650d 100644 --- a/resources/docs/widgets/matrices.md +++ b/resources/docs/widgets/matrices.md @@ -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` diff --git a/src/browser/js/app/widgets/matrices/keyboard.js b/src/browser/js/app/widgets/matrices/keyboard.js index 02fc576a..d7e84a2d 100644 --- a/src/browser/js/app/widgets/matrices/keyboard.js +++ b/src/browser/js/app/widgets/matrices/keyboard.js @@ -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)