Skip to content

Commit 3369dd1

Browse files
authored
Update piemenus.js
by this commit the note name get displayed coreectly even after no selection after the piemenu is opened
1 parent 7080a5d commit 3369dd1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

js/piemenus.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,24 @@ const piemenuPitches = (
625625
// Hide the widget when the exit button is clicked.
626626
block._exitWheel.navItems[0].navigateFunction = () => {
627627
that._piemenuExitTime = new Date().getTime();
628+
const selectedNote =
629+
that._pitchWheel.navItems[that._pitchWheel.selectedNavItemIndex].title;
630+
const selectedAccidental =
631+
!custom && that._accidentalsWheel
632+
? that._accidentalsWheel.navItems[that._accidentalsWheel.selectedNavItemIndex].title
633+
: "";
634+
635+
// Update the block's displayed text with the note and accidental
636+
if (selectedAccidental === "♮" || selectedAccidental === "") {
637+
that.text.text = selectedNote; // Natural or no accidental
638+
} else {
639+
that.text.text = selectedNote + selectedAccidental; // Combine note and accidental
640+
}
641+
642+
// Update the block value and refresh the cache
643+
that.value = selectedNote + (selectedAccidental === "♮" ? "" : selectedAccidental);
644+
that.container.setChildIndex(that.text, that.container.children.length - 1);
645+
that.updateCache();
628646
docById("wheelDiv").style.display = "none";
629647
that._pitchWheel.removeWheel();
630648
if (!custom) {

0 commit comments

Comments
 (0)