use 48 icon size

master
kkayam 2025-02-18 18:15:47 +00:00
parent 9ff82a7231
commit 32d4812251
4 changed files with 7 additions and 9 deletions

View File

@ -1 +1,2 @@
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)

View File

@ -1 +1,2 @@
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)

View File

@ -119,11 +119,7 @@
// Calculate icon dimensions // Calculate icon dimensions
let icon = apps[idx].icon; let icon = apps[idx].icon;
let iconWidth = icon.width || 48; let iconSize = 48;
let iconHeight = icon.height || 48;
let maxSize = 45;
let scale = Math.min(maxSize / iconWidth, maxSize / iconHeight);
let scaledHeight = Math.floor(iconHeight * scale);
// Define rectangle size (independent of icon size) // Define rectangle size (independent of icon size)
const rectSize = 80; const rectSize = 80;
@ -144,8 +140,8 @@
// Draw icon centered in the top portion // Draw icon centered in the top portion
let iconPadding = 8; let iconPadding = 8;
// Center icon within the rectangle // Center icon within the rectangle
let iconXInRect = rectX + (rectSize - maxSize) / 2; let iconXInRect = rectX + (rectSize - iconSize) / 2;
g.setBgColor(g.theme.bg2).drawImage(icon, iconXInRect, rect.y + iconPadding + 8, { scale: scale }); g.setBgColor(g.theme.bg2).drawImage(icon, iconXInRect, rect.y + iconPadding + 8);
// Draw app name with ellipsis if too long // Draw app name with ellipsis if too long
const maxWidth = rectSize - 8; const maxWidth = rectSize - 8;
@ -160,7 +156,7 @@
} }
text = text + ellipsis; text = text + ellipsis;
} }
let textY = rect.y + iconPadding + scaledHeight + 15; let textY = rect.y + iconPadding + iconSize + 15;
g.drawString(text, rectX + rectSize / 2, textY); g.drawString(text, rectX + rectSize / 2, textY);
}, },
select: (idx) => { select: (idx) => {

View File

@ -2,7 +2,7 @@
"id": "cutelauncher", "id": "cutelauncher",
"name": "Cute Launcher", "name": "Cute Launcher",
"shortName": "Cute Launcher", "shortName": "Cute Launcher",
"version": "0.27", "version": "0.28",
"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",