From 65ab758beaddbd6b215696d8e5674eeb6144074d Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.comā©> Date: Tue, 27 Aug 2024 22:09:44 +0200 Subject: [PATCH] pomoplus: tweak var names, apply scaling to radius Also reword the comment regarding SCALING. --- apps/pomoplus/app.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/pomoplus/app.js b/apps/pomoplus/app.js index b4ff83caf..6da740579 100644 --- a/apps/pomoplus/app.js +++ b/apps/pomoplus/app.js @@ -16,30 +16,30 @@ if ( const W = g.getWidth(); const H = g.getHeight(); -const SCALING = W/176; // The UI was tweaked to look good on a Bangle.js 2 (176x176 px). SCALING is used to adapt with the resolution of whatever device the app is running on. +const SCALING = W/176; // The UI was tweaked to look good on a Bangle.js 2 (176x176 px). SCALING automatically adapts so elements have the same proportions relative to the screen size on devices with other resolutions. const BUTTON_HEIGHT = 56 * SCALING; function drawButtons() { //Draw the backdrop const BUTTON_TOP = H - BUTTON_HEIGHT; - const IMG_SIZE = 24; - const IMG_ANCHOR_Y = BUTTON_TOP + BUTTON_HEIGHT / 2 - IMG_SIZE / 2; + const ICONS_SIZE = 24; + const ICONS_ANCHOR_Y = BUTTON_TOP + BUTTON_HEIGHT / 2 - ICONS_SIZE / 2; g.setColor(0, 0, 1) - .fillRect({x:0, y:BUTTON_TOP, x2:W-1, y2:H-1,r:15}) + .fillRect({x:0, y:BUTTON_TOP, x2:W-1, y2:H-1,r:15*SCALING}) .setColor(1, 1, 1); if (!common.state.wasRunning) { //If the timer was never started, only show a play button - g.drawImage(common.BUTTON_ICONS.play, W / 2 - IMG_SIZE / 2, IMG_ANCHOR_Y); + g.drawImage(common.BUTTON_ICONS.play, W / 2 - ICONS_SIZE / 2, ICONS_ANCHOR_Y); } else { g.setColor(g.theme.bg) .fillRect(W / 2 - 2, BUTTON_TOP, W / 2 + 2, H) .setColor(1,1,1); if (common.state.running) { - g.drawImage(common.BUTTON_ICONS.pause, W / 4 - IMG_SIZE / 2, IMG_ANCHOR_Y) - .drawImage(common.BUTTON_ICONS.skip, W * 3 / 4 - IMG_SIZE / 2, IMG_ANCHOR_Y); + g.drawImage(common.BUTTON_ICONS.pause, W / 4 - ICONS_SIZE / 2, ICONS_ANCHOR_Y) + .drawImage(common.BUTTON_ICONS.skip, W * 3 / 4 - ICONS_SIZE / 2, ICONS_ANCHOR_Y); } else { - g.drawImage(common.BUTTON_ICONS.reset, W / 4 - IMG_SIZE / 2, IMG_ANCHOR_Y) - .drawImage(common.BUTTON_ICONS.play, W * 3 / 4 - IMG_SIZE / 2, IMG_ANCHOR_Y); + g.drawImage(common.BUTTON_ICONS.reset, W / 4 - ICONS_SIZE / 2, ICONS_ANCHOR_Y) + .drawImage(common.BUTTON_ICONS.play, W * 3 / 4 - ICONS_SIZE / 2, ICONS_ANCHOR_Y); } } }