skip second draw for scrollbar for perfection

master
kkayam 2025-02-18 21:12:15 +00:00
parent 491c33c34d
commit 21c88fa9c1
4 changed files with 7 additions and 3 deletions

View File

@ -1,3 +1,4 @@
0.27: New app introduced to the app loader! 0.27: New app introduced to the app loader!
0.28: Adjusted icon size to better fit with native dimensions (48x48) 0.28: Adjusted icon size to better fit with native dimensions (48x48)
0.29: Draw function optimization 0.29: Draw function optimization
0.30: Refine initial scrollbar position

View File

@ -1,3 +1,4 @@
0.27: New app introduced to the app loader! 0.27: New app introduced to the app loader!
0.28: Adjusted icon size to better fit with native dimensions (48x48) 0.28: Adjusted icon size to better fit with native dimensions (48x48)
0.29: Draw function optimization 0.29: Draw function optimization
0.30: Refine initial scrollbar position

View File

@ -142,6 +142,7 @@
} }
let prev_idx = -1; let prev_idx = -1;
let second_call = false;
E.showScroller({ E.showScroller({
h: ITEM_HEIGHT, h: ITEM_HEIGHT,
@ -180,10 +181,11 @@
} }
let textY = rect.y + iconPadding + iconSize + 15; let textY = rect.y + iconPadding + iconSize + 15;
g.drawString(text, rectX + rectSize / 2, textY); g.drawString(text, rectX + rectSize / 2, textY);
if (idx != prev_idx && settings.scrollbar) { if (idx != prev_idx && !second_call && settings.scrollbar) {
updateScrollIndicator(idx); updateScrollIndicator(idx);
if (prev_idx == -1) second_call = true;
prev_idx = idx; prev_idx = idx;
} } else if (second_call) second_call = false;
}, },
select: (idx) => { select: (idx) => {
// Launch the selected app // Launch the selected app

View File

@ -2,7 +2,7 @@
"id": "cutelauncher", "id": "cutelauncher",
"name": "Cute Launcher", "name": "Cute Launcher",
"shortName": "Cute Launcher", "shortName": "Cute Launcher",
"version": "0.29", "version": "0.30",
"description": "A simple launcher app for Bangle.js 2 that makes use of the full touchscreen", "description": "A simple launcher app for Bangle.js 2 that makes use of the full touchscreen",
"icon": "app.png", "icon": "app.png",
"type": "launch", "type": "launch",