From 2d348b39a670227eb8bf30c121f836caef0c6ce5 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Wed, 1 Sep 2021 10:41:42 +0100 Subject: [PATCH] launchb2 0.02: Fix occasional missed image when scrolling up --- apps.json | 2 +- apps/launchb2/ChangeLog | 1 + apps/launchb2/app.js | 9 +++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps.json b/apps.json index c6bd1f8ad..d8b05de24 100644 --- a/apps.json +++ b/apps.json @@ -55,7 +55,7 @@ "name": "Launcher (Bangle.js 2)", "shortName":"Launcher", "icon": "app.png", - "version":"0.01", + "version":"0.02", "description": "This is needed by Bangle.js 2.0 to display a menu allowing you to choose your own applications. It will not work on Bangle.js 1.0.", "tags": "tool,system,launcher,b2,bno1", "type":"launch", diff --git a/apps/launchb2/ChangeLog b/apps/launchb2/ChangeLog index 5560f00bc..0b07ccddb 100644 --- a/apps/launchb2/ChangeLog +++ b/apps/launchb2/ChangeLog @@ -1 +1,2 @@ 0.01: New App! +0.02: Fix occasional missed image when scrolling up diff --git a/apps/launchb2/app.js b/apps/launchb2/app.js index 183c09745..a5b265318 100644 --- a/apps/launchb2/app.js +++ b/apps/launchb2/app.js @@ -47,8 +47,13 @@ Bangle.on('drag',e=>{ g.reset().setClipRect(0,24,g.getWidth()-1,g.getHeight()-1); g.scroll(0,dy); menuScroll -= dy; - if (e.dy < 0) drawApp(Math.floor((menuScroll+24)/APPH)+n-1); - else drawApp(Math.floor((menuScroll+24)/APPH)); + if (e.dy < 0) { + drawApp(Math.floor((menuScroll+24+g.getHeight())/APPH)-1); + if (e.dy <= -APPH) drawApp(Math.floor((menuScroll+24+g.getHeight())/APPH)-2); + } else { + drawApp(Math.floor((menuScroll+24)/APPH)); + if (e.dy >= APPH) drawApp(Math.floor((menuScroll+24)/APPH)+1); + } g.setClipRect(0,0,g.getWidth()-1,g.getHeight()-1); }); Bangle.on("touch",(_,e)=>{