2626
2727 Queue, Logo, LogoDependencies, DEFAULTVOLUME, PREVIEWVOLUME, DEFAULTDELAY,
2828 OSCVOLUMEADJUSTMENT, TONEBPM, TARGETBPM, TURTLESTEP, NOTEDIV,
29+ MIN_HIGHLIGHT_DURATION_MS,
2930 NOMICERRORMSG, NANERRORMSG, NOSTRINGERRORMSG, NOBOXERRORMSG,
3031 NOACTIONERRORMSG, NOINPUTERRORMSG, NOSQRTERRORMSG,
3132 ZERODIVIDEERRORMSG, EMPTYHEAPERRORMSG, INVALIDPITCH, POSNUMBER,
@@ -1529,6 +1530,10 @@ class Logo {
15291530 // Highlight the current block
15301531 logo . activity . blocks . highlight ( blk , false ) ;
15311532 logo . _currentlyHighlightedBlock = blk ;
1533+ // Force stage update so highlight is visible when blocks were shown during execution
1534+ if ( logo . activity . stage ) {
1535+ logo . activity . stage . update ( ) ;
1536+ }
15321537 }
15331538 }
15341539
@@ -1670,15 +1675,22 @@ class Logo {
16701675 logo . _unhighlightStepQueue [ turtle ] = blk ;
16711676 } else {
16721677 if ( ! tur . singer . suppressOutput && tur . singer . justCounting . length === 0 ) {
1678+ const unhighlightDelay = Math . max (
1679+ logo . turtleDelay + tur . waitTime ,
1680+ MIN_HIGHLIGHT_DURATION_MS
1681+ ) ;
16731682 setTimeout ( ( ) => {
16741683 if ( logo . activity . blocks . visible ) {
16751684 logo . activity . blocks . unhighlight ( blk ) ;
16761685 // Clear the currently highlighted block if it was this one
16771686 if ( logo . _currentlyHighlightedBlock === blk ) {
16781687 logo . _currentlyHighlightedBlock = null ;
16791688 }
1689+ if ( logo . activity . stage ) {
1690+ logo . activity . stage . update ( ) ;
1691+ }
16801692 }
1681- } , logo . turtleDelay + tur . waitTime ) ;
1693+ } , unhighlightDelay ) ;
16821694 }
16831695 }
16841696 }
@@ -1703,6 +1715,10 @@ class Logo {
17031715 tur . unhighlightQueue . push ( logo . deps . utils . last ( tur . parentFlowQueue ) ) ;
17041716 } else if ( tur . unhighlightQueue . length > 0 ) {
17051717 // The child flow is finally complete, so unhighlight.
1718+ const unhighlightDelay = Math . max (
1719+ logo . turtleDelay ,
1720+ MIN_HIGHLIGHT_DURATION_MS
1721+ ) ;
17061722 setTimeout ( ( ) => {
17071723 if ( logo . activity . blocks . visible ) {
17081724 const unhighlightBlock = tur . unhighlightQueue . pop ( ) ;
@@ -1711,10 +1727,13 @@ class Logo {
17111727 if ( logo . _currentlyHighlightedBlock === unhighlightBlock ) {
17121728 logo . _currentlyHighlightedBlock = null ;
17131729 }
1730+ if ( logo . activity . stage ) {
1731+ logo . activity . stage . update ( ) ;
1732+ }
17141733 } else {
17151734 tur . unhighlightQueue . pop ( ) ;
17161735 }
1717- } , logo . turtleDelay ) ;
1736+ } , unhighlightDelay ) ;
17181737 }
17191738 }
17201739 }
0 commit comments