Improve icon positions on Gabbro

This commit is contained in:
2026-07-19 14:59:42 -04:00
parent 2381dd27b1
commit e36925eccb
+10 -7
View File
@@ -5,14 +5,17 @@
#include <pebble.h> #include <pebble.h>
#if PBL_PLATFORM_EMERY #if PBL_PLATFORM_EMERY
const int8_t ICON_X_OFFSET = 0;
const uint16_t UP_Y = 45; const uint16_t UP_Y = 45;
const uint16_t SELECT_Y = 105; const uint16_t SELECT_Y = 105;
const uint16_t DOWN_Y = 165; const uint16_t DOWN_Y = 165;
#elif PBL_PLATFORM_GABBRO // TODO Improve button positions (validate against official) #elif PBL_PLATFORM_GABBRO
const uint16_t UP_Y = 90; const int8_t ICON_X_OFFSET = -1;
const uint16_t UP_Y = 80;
const uint16_t SELECT_Y = 121; const uint16_t SELECT_Y = 121;
const uint16_t DOWN_Y = 160; const uint16_t DOWN_Y = 162;
#else #else
const int8_t ICON_X_OFFSET = 0;
const uint16_t UP_Y = 50; const uint16_t UP_Y = 50;
const uint16_t SELECT_Y = 90; const uint16_t SELECT_Y = 90;
const uint16_t DOWN_Y = 120; const uint16_t DOWN_Y = 120;
@@ -118,15 +121,15 @@ static void s_recenter_icons(NeatBarLayer *neat_bar) {
int8_t spread = neat_bar->spread; int8_t spread = neat_bar->spread;
if (neat_bar->up_layer) { if (neat_bar->up_layer) {
layer_set_frame(bitmap_layer_get_layer(neat_bar->up_layer), layer_set_frame(bitmap_layer_get_layer(neat_bar->up_layer),
GRect(0, UP_Y - spread - y_offset, neat_bar->main_grect.size.w, 18)); GRect(ICON_X_OFFSET, UP_Y - spread - y_offset, neat_bar->main_grect.size.w, 18));
} }
if (neat_bar->select_layer) { if (neat_bar->select_layer) {
layer_set_frame(bitmap_layer_get_layer(neat_bar->select_layer), layer_set_frame(bitmap_layer_get_layer(neat_bar->select_layer),
GRect(0, SELECT_Y - y_offset, neat_bar->main_grect.size.w, 18)); GRect(ICON_X_OFFSET, SELECT_Y - y_offset, neat_bar->main_grect.size.w, 18));
} }
if (neat_bar->down_layer) { if (neat_bar->down_layer) {
layer_set_frame(bitmap_layer_get_layer(neat_bar->down_layer), layer_set_frame(bitmap_layer_get_layer(neat_bar->down_layer),
GRect(0, DOWN_Y + spread - y_offset, neat_bar->main_grect.size.w, 18)); GRect(ICON_X_OFFSET, DOWN_Y + spread - y_offset, neat_bar->main_grect.size.w, 18));
} }
} }
@@ -249,7 +252,7 @@ void neat_bar_layer_set_icon(NeatBarLayer *neat_bar, ButtonId button_id, GBitmap
int16_t adjusted_y = (button_id == BUTTON_ID_UP) ? y_pos - neat_bar->spread int16_t adjusted_y = (button_id == BUTTON_ID_UP) ? y_pos - neat_bar->spread
: (button_id == BUTTON_ID_DOWN) ? y_pos + neat_bar->spread : (button_id == BUTTON_ID_DOWN) ? y_pos + neat_bar->spread
: y_pos; : y_pos;
current_bitmap_layer = bitmap_layer_create(GRect(0, adjusted_y, neat_bar->main_grect.size.w, 18)); current_bitmap_layer = bitmap_layer_create(GRect(ICON_X_OFFSET, adjusted_y, neat_bar->main_grect.size.w, 18));
layer_add_child(neat_bar->main_layer, bitmap_layer_get_layer(current_bitmap_layer)); layer_add_child(neat_bar->main_layer, bitmap_layer_get_layer(current_bitmap_layer));
switch (button_id) { switch (button_id) {
case BUTTON_ID_UP: case BUTTON_ID_UP: