Make bar height adjustable

This commit is contained in:
2026-07-19 11:56:27 -04:00
parent 65db01d4c3
commit 92780d18b1
2 changed files with 16 additions and 3 deletions
+15 -3
View File
@@ -56,17 +56,18 @@ inline static void s_update_click_config_provider(NeatBarLayer *neat_bar) {
}
static void s_recenter_icons(NeatBarLayer *neat_bar) {
int16_t y_offset = neat_bar->main_grect.origin.y;
if (neat_bar->up_layer) {
layer_set_frame(bitmap_layer_get_layer(neat_bar->up_layer),
GRect(1, UP_Y, neat_bar->main_grect.size.w, 18));
GRect(1, UP_Y - y_offset, neat_bar->main_grect.size.w, 18));
}
if (neat_bar->select_layer) {
layer_set_frame(bitmap_layer_get_layer(neat_bar->select_layer),
GRect(1, SELECT_Y, neat_bar->main_grect.size.w, 18));
GRect(1, SELECT_Y - y_offset, neat_bar->main_grect.size.w, 18));
}
if (neat_bar->down_layer) {
layer_set_frame(bitmap_layer_get_layer(neat_bar->down_layer),
GRect(1, DOWN_Y, neat_bar->main_grect.size.w, 18));
GRect(1, DOWN_Y - y_offset, neat_bar->main_grect.size.w, 18));
}
}
@@ -127,6 +128,17 @@ void neat_bar_layer_set_width(NeatBarLayer *neat_bar, uint16_t width) {
s_recenter_icons(neat_bar);
}
void neat_bar_layer_set_height(NeatBarLayer *neat_bar, uint16_t height) {
if (height == neat_bar->main_grect.size.h) {
return;
}
neat_bar->main_grect.origin.y = (PBL_DISPLAY_HEIGHT - height) / 2;
neat_bar->main_grect.size.h = height;
layer_set_frame(neat_bar->main_layer, neat_bar->main_grect);
layer_mark_dirty(neat_bar->main_layer);
s_recenter_icons(neat_bar);
}
void neat_bar_layer_set_corner_radius(NeatBarLayer *neat_bar, uint16_t corner_radius) {
if (corner_radius == neat_bar->corner_radius) {
return;