File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed
Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change 2626 }
2727 } ;
2828
29+ let isWeHidingTheWidgets = false ;
2930 let timeout ;
3031 let onMusicVolume = ( volPercent ) => {
3132 if ( timeout ) { clearTimeout ( timeout ) ; }
3233
3334 if ( Bangle . CLOCK ) {
3435
3536 let isAllWidgetsHidden = true ;
36- if ( global . WIDGETS ) {
37- for ( var w of global . WIDGETS ) {
38- if ( ! w . _draw ) {
39- isAllWidgetsHidden = false ;
40- break ;
37+ if ( ! timeout ) { // No need to do this if we already did it before and it wasn't undone. I.e. the timout to execute `goAway` never ran out.
38+ if ( global . WIDGETS ) {
39+ for ( var w of global . WIDGETS ) {
40+ if ( ! w . _draw ) {
41+ isAllWidgetsHidden = false ;
42+ break ;
43+ }
4144 }
4245 }
46+ if ( ! isAllWidgetsHidden ) {
47+ WIDGET_UTILS_HIDE ( ) ;
48+ isWeHidingTheWidgets = true ; // Remember if it was we who hid the widgets between draws of the volume bar.
49+ }
4350 }
44- if ( ! timeout ) { WIDGET_UTILS_HIDE ( ) ; }
4551 let barWidth = g . getWidth ( ) * volPercent / 100 ;
4652 g .
4753 setColor ( 0x0000 ) . fillRect ( 0 , 0 , g . getWidth ( ) , 24 ) .
5056 drawString ( "volume" , barWidth , 1 ) ;
5157
5258 let goAway = ( ) => {
53- if ( ! isAllWidgetsHidden ) {
59+ if ( isWeHidingTheWidgets ) {
5460 g . reset ( ) . clearRect ( 0 , 0 , g . getWidth ( ) , 24 ) ;
5561 WIDGET_UTILS_SHOW ( ) ;
62+ isWeHidingTheWidgets = false ;
5663 } else if ( Bangle . uiRedraw ) {
5764 Bangle . uiRedraw ( ) ;
5865 } else {
You can’t perform that action at this time.
0 commit comments