sugarlabs / musicblocks

Music Blocks -- A musical microworld
https://musicblocks.sugarlabs.org/
GNU Affero General Public License v3.0
571 stars 775 forks source link

Flats are not accounted for in keyboard widget #1397

Closed pikurasa closed 6 years ago

pikurasa commented 6 years ago

I noticed reading through widgets.js that the sharps are accounted for in rendering the keyboard (i.e. crating black keys), but not the flats.

L106 of widget/musickeyboard.js

            for (var p = 0; p < this.rowLabels1.length; p++){
                if (this.rowLabels1[p][2] === '♯' || this.rowLabels1[p][3] === '♯'){
                    var parenttbl2 = document.getElementById('myrow2');
                    var newel2 = document.createElement('td');
                    var elementid2 = document.getElementsByTagName('td').length

                    newel2.setAttribute('id',elementid2);
                    idContainer.push(elementid2);
                    newel2.innerHTML = this.rowLabels1[p] + this.rowArgs1[p];
                    parenttbl2.appendChild(newel2);
                } else {
                    var parenttbl = document.getElementById('myrow');
                    var newel = document.createElement('td');
                    var elementid = document.getElementsByTagName('td').length

                    newel.setAttribute('id',elementid);
                    idContainer.push(elementid);
                    newel.innerHTML = this.rowLabels1[p] + this.rowArgs1[p];
                    parenttbl.appendChild(newel);
                }

sol flat is white key screenshot at 2018-10-01 00 13 25 fa solb sol flat and fa sharp are not recognized as the same screenshot at 2018-09-30 23 58 53 black keys not accounting for flat

walterbender commented 6 years ago

This is fixed.

screenshot from 2018-10-02 17-01-08

Opening a new issue the some other problems with the MKB code.