File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -326,15 +326,16 @@ exports.addInteractive = function(menu, options) {
326326 const blur = ( ) => {
327327 options . focus = false ;
328328 Bangle . CLKINFO_FOCUS -- ;
329- // if (Bangle.CLKINFO_FOCUS < 0) Bangle.CLKINFO_FOCUS = 0;
330329 const itm = menu [ options . menuA ] . items [ options . menuB ] ;
331330 let redraw = true ;
332331 if ( itm . blur && itm . blur ( options ) === false )
333332 redraw = false ;
334333 if ( redraw ) options . redraw ( ) ;
335334 } ;
336- // better to only call blur when we know it's focused. Maybe we can rename force_blur to ensure_blur.
337- options . force_blur = blur ;
335+ // better to only call blur when we know it's focused. Could reuse this logic in this file
336+ options . ensure_blur = ( ) => {
337+ if ( options . focus ) blur ( )
338+ }
338339 const focus = ( ) => {
339340 let redraw = true ;
340341 Bangle . CLKINFO_FOCUS = ( 0 | Bangle . CLKINFO_FOCUS ) + 1 ;
Original file line number Diff line number Diff line change 5757 }
5858 } . init ( ) ;
5959
60+ // We make clock info touch area active on the start of the animation
6061 Bangle . on ( "widgets-start-show" , ( ) => {
6162 var wi = WIDGETS [ "clkinfo" ] ;
6263 if ( wi ) {
7677 Bangle . on ( "widgets-start-hide" , ( ) => {
7778 var wi = WIDGETS [ "clkinfo" ] ;
7879 if ( wi ) {
79- if ( wi . clockInfoMenu . focus ) wi . clockInfoMenu . blur ( ) ;
80+ wi . clockInfoMenu . ensure_blur ( ) ; // let user see defocus cue before hiding
8081 wi . clockInfoMenu . y = - 24 ;
8182 wi . draw ( wi ) ;
8283 }
8586 Bangle . on ( "widgets-hidden" , ( ) => {
8687 var wi = WIDGETS [ "clkinfo" ] ;
8788 if ( wi ) {
88- if ( wi . clockInfoMenu . focus ) wi . clockInfoMenu . blur ( ) ;
89+ wi . clockInfoMenu . ensure_blur ( ) ;
8990 wi . clockInfoMenu . y = - 24 ;
9091 wi . draw ( wi ) ;
9192 }
You can’t perform that action at this time.
0 commit comments