@@ -9,30 +9,19 @@ if (isClock) {
99
1010// once at the start
1111let background = require ( "clockbg" ) ;
12-
13- // to fill the whole area
14- background . fillRect ( Bangle . appRect . x + 3 , Bangle . appRect . y + 3 , Bangle . appRect . x + Bangle . appRect . w - 5 , Bangle . appRect . y + Bangle . appRect . h - 5 ) ;
15- // if you ever need to reload to a new background (this could take ~100ms)
16- //background.reload();
17-
18- // Call this to unload (free memory - eg in .remove when fast loading)
19- //background.unload();
20-
21- // If .unload has been called and you might have fast-loaded back, call .load to ensure everything is loaded again!
22- // It won't reload if it's already been loaded
23- //background.load();
12+ let clock_info = require ( "clock_info" ) ;
2413
2514// Load the clock infos
26- let clockInfoItems = require ( " clock_info" ) . load ( ) ;
15+ let clockInfoItems = clock_info . load ( ) ;
2716if ( clockInfoItems [ 0 ] . items [ 6 ] ) { // TODO: Should maybe be more robust against changes to clock info, i.e. search for "clock" among items.
2817 let clockItem = clockInfoItems [ 0 ] . items . pop ( ) ;
2918 clockInfoItems [ 0 ] . items . unshift ( clockItem ) ;
3019}
3120// Add the
32- let clockInfoMenu = require ( "clock_info" ) . addInteractive ( clockInfoItems , {
21+ let clockInfoMenu = clock_info . addInteractive ( clockInfoItems , {
22+ app : "bigclkinfo" ,
3323 // Add the dimensions we're rendering to here - these are used to detect taps on the clock info area
34- x : 0 , y : 0 , w : Bangle . appRect . w , h : Bangle . appRect . h , app : "bigclkinfo" ,
35- // You can add other information here you want to be passed into 'options' in 'draw'
24+ x : 0 , y : 0 , w : Bangle . appRect . w , h : Bangle . appRect . h , // You can add other information here you want to be passed into 'options' in 'draw'
3625 // This function draws the info
3726 draw : ( itm , info , options ) => {
3827 // itm: the item containing name/hasRange/etc
@@ -46,8 +35,8 @@ let clockInfoMenu = require("clock_info").addInteractive(clockInfoItems, {
4635 // we're drawing center-aligned here
4736 var midx = options . x + options . w / 2 ;
4837 let scale = 4 ;
49- if ( info . img ) require ( " clock_info" ) . drawBorderedImage ( info . img , midx - 12 * scale , options . y + 10 , { scale :scale } ) ; // draw the image
50- let foundFontText = g . findFont ( info . text , {
38+ if ( info . img ) clock_info . drawBorderedImage ( info . img , midx - 12 * scale , options . y + 10 , { scale :scale } ) ; // draw the image
39+ let foundFontText = g . findFont ( info . text , {
5140 w : Bangle . appRect . w - 9 , // optional: width available (default = screen width)
5241 h : Bangle . appRect . h * 2 / 5 , // optional: height available (default = screen height)
5342 min : 10 , // optional: min font height
0 commit comments