Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

widgets/musickeyboard ES6 port, enhancements etc. #2826

Closed
wants to merge 5 commits into from

Conversation

ricknjacky
Copy link
Member

Issue references:- #2767, #2630, #2609 #2629

In this PR, I have:-

  • Ported widgets/musickeyboard.js file to ES6 class syntax.
  • Made minor enhancements to UI of the keyboard
  • Took care of linting and prettifying the file.

@ricknjacky
Copy link
Member Author

@walterbender please review.

ps:- this is in regard to comment,
I had initially misinterpreted the behavior of keyboard. I presumed that all keys were supposed to have text irrespective of whether or not they were present in clamps blocks.
As, that's not the case bug described in #2796 is not technically a bug, it was a minor misinterpretation I did.

Minor UI enhancement is what I thought was relevant here and that's what I have done.

Copy link
Member

@ksraj123 ksraj123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please go through my comments. Thanks

js/widgets/musickeyboard.js Outdated Show resolved Hide resolved
js/widgets/musickeyboard.js Outdated Show resolved Hide resolved
js/widgets/musickeyboard.js Outdated Show resolved Hide resolved
* @returns {void}
*/

init() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be better if we could remove the init function and do things in the constructor instead, please make the necessary changes where the class is instantiated as well. We could make another function to setup the UI elements and event listeners and call it from the constructor for making our code more organised. Thanks

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's imperative to reach a consensus on this.

  • phrasemaker
  • pitchdrummatrix
  • pitchslider
  • pitchstaircase
  • rhythmruler
  • status
  • temperament
  • tempo
  • timbre

all of these widgets have init function. If we're deciding to eradicate init function all together, it be done with all widgets and not just arbitrarily.

@ricknjacky
Copy link
Member Author

@ksraj123 thanks for the review, I have committed your suggestions.

@meganindya Please read my comment on @ksraj123's suggestion for eradication of init() , pls update on the same, Thanks.

@meganindya
Copy link
Member

Initially I thought putting all the init stuff in the constructor made a lot of sense because that's what a constructor is supposed to do: initialize. But, I noticed that the widget classes (or prototype functions) aren't consistent with their initialization. The object is created when the clamp block of the widget is visited, and the DOM is initialized when the hidden block at the end of the block is executed (i.e. when the clamp block is exited). The DOM initialization sometimes depends on the contents of the clamp block, other times it doesn't. Since there is inconsistency it needs refactoring to standardize the equation all across.

But, all that doesn't help the application on the user-end; it is merely a cosmetic operation on the codebase. And, since this application is going to be replaced soon, I don't see much value in doing that. So, I think it's better to keep it as is. Even the code refactoring isn't helping a lot right now, unless it makes the application more stable for archiving. Don't bother much with these.

@meganindya
Copy link
Member

Something like #2632 is a higher priority requirement as it significantly helps with the stability of the application, which currently is very unstable and unpredictable when hosted remotely.

@ricknjacky
Copy link
Member Author

Thanks for the insight @meganindya

I presume this PR is ready to be merged then, please review @walterbender

@walterbender
Copy link
Member

I think that the behavior of the + button has changed. Could you please test?

@ricknjacky
Copy link
Member Author

I think that the behavior of the + button has changed. Could you please test?

Sure

Behavior on my local (concurrent with this PR's branch MusicKeyB):

MB_local.mp4
  • Hertz note of frequency 261 added.
  • Note Re 5 added

Behavior on Master branch (in sync with MB's master):

MB_master.mp4
  • Hertz note of frequency 261 added.
  • Note Sol 5 added

They're identical, just the notes that were added with presets are different.
If I have missed something however, please do share the feedback.

@walterbender
Copy link
Member

As you can see in your video, the pitch block created was not properly attached to the music keyboard clamp --- it stayed in the upper left behind the palette. There seems to be a bug with the connections when adding the new block.

@ricknjacky
Copy link
Member Author

ricknjacky commented Feb 10, 2021

As you can see in your video, the pitch block created was not properly attached to the music keyboard clamp --- it stayed in the upper left behind the palette. There seems to be a bug with the connections when adding the new block.

Right, this is a regression

Also, this behavior is prevalent on both master branch and this PR.
Somehow, we've missed this all along.

@ricknjacky
Copy link
Member Author

As you can see in your video, the pitch block created was not properly attached to the music keyboard clamp --- it stayed in the upper left behind the palette. There seems to be a bug with the connections when adding the new block.

Any addition be it hertz or pitch seems to have this bug in this widget,
Also, if we

  • (i)add hertz first--then it is not added to the clamp.

But if I then [after(i)],

  • (ii)add any other note or pitch then the hertz added in step (i) is now in the clamp connected as it was supposed to be initially.

I'm trying to find the cause of this bug.
Any suggestions as to where it can be or what needs to be done that can help me alleviate this bug?

@walterbender
Copy link
Member

I've not looked, but the place to look is in the code that chains together the blocks after the new block is created, beginning at L 1397 in the old code. (The problem may be in _addNotesBlockBetween() as it seems the insertion is broken.)

@ricknjacky
Copy link
Member Author

@walterbender please take a look at #2839
also, I investigated the error described above..error isn't in this file it is in blocks.js file i presume.

If we add a note, then drag the new added note around..you can see the notes that were present in clamp join the new added note to form a seperate new group. connections property seems ok to me in this file. Please correct me if I have missed something though.
Please do share your thoughts on this.

@ksraj123
Copy link
Member

ksraj123 commented Feb 15, 2021

Hey @ricknjacky, I find this issue of improper alignment of blocks inside the clamp when new ones are added interesting. I would like to give this a try if you are facing some difficulties with it. Thanks
cc - @walterbender

@ricknjacky
Copy link
Member Author

Hey @ricknjacky, I find this issue of improper alignment of blocks inside the clamp when new ones are added interesting. I would like to give this a try if you are facing some difficulties with it. Thanks
cc - @walterbender

Definitely, it'll be a great opportunity for me to work with you and learn a lot. Please tell me if I can help with anything..

also..there are a lot of other bugs I've tagged an issue above.. let's solve all these once and for all. 👍

@ksraj123
Copy link
Member

Hey @ricknjacky, I find this issue of improper alignment of blocks inside the clamp when new ones are added interesting. I would like to give this a try if you are facing some difficulties with it. Thanks
cc - @walterbender

Definitely, it'll be a great opportunity for me to work with you and learn a lot. Please tell me if I can help with anything..

also..there are a lot of other bugs I've tagged an issue above.. let's solve all these once and for all. 👍

Sounds great. I have opened a PR #2844 fixing this issue.
@walterbender Please have a look. Thanks

@ricknjacky ricknjacky closed this Feb 17, 2021
@ricknjacky ricknjacky deleted the MusicKeyB branch March 2, 2021 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants