mirror of https://github.com/espruino/BangleApps
setuichange: throw if custom drag on some modes
If custom drag handler is added together with mode updown or leftright throw an exception.pull/3563/head
parent
4d8c46ba51
commit
c757b85760
|
@ -1,3 +1,5 @@
|
|||
0.01: New App!
|
||||
0.02: Fix case where we tried to push to Bangle.btnWatches but it wasn't
|
||||
defined.
|
||||
0.03: Throw exception if trying to add custom drag handler on mode updown and
|
||||
leftright.
|
||||
|
|
|
@ -39,6 +39,7 @@ Bangle.setUI = (function(mode, cb) {
|
|||
try{Bangle.buzz(30);}catch(e){}
|
||||
}
|
||||
if (mode=="updown") {
|
||||
if (options.drag) throw new Error("Custom drag handler not supported in mode updown!")
|
||||
var dy = 0;
|
||||
Bangle.dragHandler = e=>{
|
||||
dy += e.dy;
|
||||
|
@ -55,6 +56,7 @@ Bangle.setUI = (function(mode, cb) {
|
|||
setWatch(function() { b();cb(); }, BTN1, {repeat:1, edge:"rising"}),
|
||||
];
|
||||
} else if (mode=="leftright") {
|
||||
if (options.drag) throw new Error("Custom drag handler not supported in mode leftright!")
|
||||
var dx = 0;
|
||||
Bangle.dragHandler = e=>{
|
||||
dx += e.dx;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ "id": "setuichange",
|
||||
"name": "SetUI Proposals preview",
|
||||
"version":"0.02",
|
||||
"version":"0.03",
|
||||
"description": "Try out potential future changes to `Bangle.setUI`. Makes hardware button interaction snappier. Makes it possible to set custom event handlers on any type/mode, not just `\"custom\"`. Please provide feedback - see `Read more...` below.",
|
||||
"icon": "app.png",
|
||||
"tags": "",
|
||||
|
|
Loading…
Reference in New Issue