File tree Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 24
24
Jolt.js: Increase Storage area from 40kb to 400kb
25
25
nRF5x: Don't add BLE UART write events into the input buffer
26
26
ESP32: Timers are now turned off when requested - digitalPulse/soft pwm/writeAtTime more accurate
27
- Bangle.js : Remove debug log messages from E.showScroller
27
+ Bangle.js2 : Remove debug log messages from E.showScroller
28
28
STM32F4: Update stm32f4xx_ll_usb to fix over-buffered USB CDC tx after being woken from deep sleep
29
29
Waveform: Add 'npin' option to allow +/- output on two pins
30
30
Waveform: Add ability to play directly from Storage
41
41
Bangle.js: E.showMenu no longer sends the internal `l` menu object as argument when running the callback function.
42
42
Bangle.js2: GPS request RMC packet automatically (so GPS speed/time work even without AGPS) (fix #2354)
43
43
Bangle.js2: GPS now detects binary CASIC packets and splits them into their own GPS-raw event
44
+ Bangle.js2: Pass the modified touch event on through both E.showScroller and E.showMenu (to enable more complex interaction with menus).
44
45
45
46
2v24 : Bangle.js2: Add 'Bangle.touchRd()', 'Bangle.touchWr()'
46
47
Bangle.js2: After Bangle.showTestScreen, put Bangle.js into a hard off state (not soft off)
Original file line number Diff line number Diff line change @@ -5932,6 +5932,10 @@ On Bangle.js there are a few additions over the standard `graphical_menu`:
5932
5932
menu is removed
5933
5933
* (Bangle.js 2) `scroll : int` - an integer specifying how much the initial
5934
5934
menu should be scrolled by
5935
+ * (Bangle.js 2) The mapped functions can consider the touch event that interacted with the entry:
5936
+ `"Entry" : function(touch) { ... }`
5937
+ * This is also true of `onchange` mapped functions in entry objects:
5938
+ `onchange : (value, touch) => { ... }`
5935
5939
* The object returned by `E.showMenu` contains:
5936
5940
* (Bangle.js 2) `scroller` - the object returned by `E.showScroller` -
5937
5941
`scroller.scroll` returns the amount the menu is currently scrolled by
@@ -6074,6 +6078,7 @@ Supply an object containing:
6074
6078
draw : function(idx, rect) { ... }
6075
6079
// a function to call when the item is selected, touch parameter is only relevant
6076
6080
// for Bangle.js 2 and contains the coordinates touched inside the selected item
6081
+ // as well as the type of the touch - see `Bangle.touch`.
6077
6082
select : function(idx, touch) { ... }
6078
6083
// optional function to be called when 'back' is tapped
6079
6084
back : function() { ...}
Original file line number Diff line number Diff line change 133
133
l = g . setFont ( "6x15" ) . wrapString ( title , r . w - pad ) ;
134
134
g . setFontAlign ( - 1 , 0 ) . drawString ( l . join ( "\n" ) , r . x + 12 , r . y + H / 2 ) ;
135
135
} ,
136
- select : function ( idx ) {
136
+ select : function ( idx , touch ) {
137
137
if ( idx < 0 ) return back && back ( ) ; // title
138
138
var item = menu [ keys [ idx ] ] ;
139
139
Bangle . buzz ( 20 ) ;
140
- if ( "function" == typeof item ) item ( ) ;
140
+ if ( "function" == typeof item ) item ( touch ) ;
141
141
else if ( "object" == typeof item ) {
142
- // if a bool, just toggle it
143
142
if ( "number" == typeof item . value ) {
144
143
showSubMenu ( item , keys [ idx ] ) ;
145
144
} else {
145
+ // if a bool, just toggle it
146
146
if ( "boolean" == typeof item . value )
147
147
item . value = ! item . value ;
148
- if ( item . onchange ) item . onchange ( item . value ) ;
148
+ if ( item . onchange ) item . onchange ( item . value , touch ) ;
149
149
if ( l . scroller . isActive ( ) ) l . scroller . drawItem ( idx ) ;
150
150
}
151
151
}
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ Bangle.setUI({
82
82
}
83
83
if ( ( menuScrollMin < 0 || i >= 0 ) && i < options . c ) {
84
84
//console.log("Press ",e.y,i,yInElement);
85
- options . select ( i , { x :e . x , y :yInElement } ) ;
85
+ options . select ( i , { x :e . x , y :yInElement , type : e . type } ) ;
86
86
}
87
87
}
88
88
} ) ;
You can’t perform that action at this time.
0 commit comments