Skip to content

Commit

Permalink
Merge pull request #3563 from thyttan/setui-proposal-preview
Browse files Browse the repository at this point in the history
setuichange: throw if custom drag on some modes
  • Loading branch information
gfwilliams authored Sep 11, 2024
2 parents 17ee644 + c757b85 commit bb92699
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions apps/setuichange/ChangeLog
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions apps/setuichange/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion apps/setuichange/metadata.json
Original file line number Diff line number Diff line change
@@ -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": "",
Expand Down

0 comments on commit bb92699

Please sign in to comment.