Fix legacy animations w/custom corner radius/floating mode
This commit is contained in:
+8
-4
@@ -152,19 +152,23 @@ static void s_main_layer_update_proc(Layer *layer, GContext *ctx) {
|
|||||||
graphics_context_set_fill_color(ctx, neat_bar->background_color);
|
graphics_context_set_fill_color(ctx, neat_bar->background_color);
|
||||||
graphics_fill_rect(ctx, bounds, neat_bar->corner_radius, neat_bar->x_offset > 0 ? GCornersAll : GCornersLeft);
|
graphics_fill_rect(ctx, bounds, neat_bar->corner_radius, neat_bar->x_offset > 0 ? GCornersAll : GCornersLeft);
|
||||||
|
|
||||||
// Legacy animation: invert the background third for any pressed button
|
// legacy animation: invert the background third for any pressed button
|
||||||
if (neat_bar->animations_legacy_pressed_color) {
|
if (neat_bar->animations_legacy_pressed_color) {
|
||||||
int16_t third_height = bounds.size.h / 3;
|
int16_t third_height = bounds.size.h / 3;
|
||||||
graphics_context_set_fill_color(ctx, *neat_bar->animations_legacy_pressed_color);
|
uint16_t radius = neat_bar->corner_radius;
|
||||||
|
uint16_t inner_radius = radius > 0 ? radius - 1 : 0;
|
||||||
|
graphics_context_set_fill_color(ctx, *(neat_bar->animations_legacy_pressed_color));
|
||||||
|
|
||||||
if (neat_bar->up_pressed) {
|
if (neat_bar->up_pressed) {
|
||||||
graphics_fill_rect(ctx, GRect(1, 1, bounds.size.w - 2, third_height - 2), 0, GCornerNone);
|
graphics_fill_rect(ctx, GRect(1, 1, bounds.size.w - 2, third_height - 2), inner_radius,
|
||||||
|
neat_bar->x_offset > 0 ? GCornersTop : GCornerTopLeft);
|
||||||
}
|
}
|
||||||
if (neat_bar->select_pressed) {
|
if (neat_bar->select_pressed) {
|
||||||
graphics_fill_rect(ctx, GRect(1, third_height + 1, bounds.size.w - 2, third_height - 2), 0, GCornerNone);
|
graphics_fill_rect(ctx, GRect(1, third_height + 1, bounds.size.w - 2, third_height - 2), 0, GCornerNone);
|
||||||
}
|
}
|
||||||
if (neat_bar->down_pressed) {
|
if (neat_bar->down_pressed) {
|
||||||
graphics_fill_rect(ctx, GRect(1, third_height * 2 + 1, bounds.size.w - 2, bounds.size.h - third_height * 2 - 2), 0, GCornerNone);
|
graphics_fill_rect(ctx, GRect(1, third_height * 2 + 1, bounds.size.w - 2, bounds.size.h - third_height * 2 - 2), inner_radius,
|
||||||
|
neat_bar->x_offset > 0 ? GCornersBottom : GCornerBottomLeft);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user