Fix display of trig function options

This commit is contained in:
2026-08-06 20:23:27 -04:00
parent 49367e26d2
commit 30afb37047
+19 -7
View File
@@ -64,9 +64,12 @@ static const GRect s_drop_type_grect = GRect(PBL_IF_ROUND_ELSE(48, 62), (s_top_b
static const GRect s_drop_function_grect = GRect(PBL_IF_ROUND_ELSE(55, 45), s_bottom_bar_grect.origin.y + ((s_bottom_bar_grect.size.h / 2) - PBL_IF_ROUND_ELSE(s_drop_height - 1, s_drop_height / 2)), 50, s_drop_height); static const GRect s_drop_function_grect = GRect(PBL_IF_ROUND_ELSE(55, 45), s_bottom_bar_grect.origin.y + ((s_bottom_bar_grect.size.h / 2) - PBL_IF_ROUND_ELSE(s_drop_height - 1, s_drop_height / 2)), 50, s_drop_height);
static const GRect s_drop_over_grect = GRect(s_drop_function_grect.origin.x + 78, s_drop_function_grect.origin.y - 13, s_drop_function_grect.size.w + 1, s_drop_function_grect.size.h); static const GRect s_drop_over_grect = GRect(s_drop_function_grect.origin.x + 78, s_drop_function_grect.origin.y - 13, s_drop_function_grect.size.w + 1, s_drop_function_grect.size.h);
static const GRect s_drop_under_grect = GRect(s_drop_over_grect.origin.x, s_drop_over_grect.origin.y + s_drop_over_grect.size.h + 5, s_drop_function_grect.size.w, s_drop_over_grect.size.h); static const GRect s_drop_under_grect = GRect(s_drop_over_grect.origin.x, s_drop_over_grect.origin.y + s_drop_over_grect.size.h + 5, s_drop_function_grect.size.w, s_drop_over_grect.size.h);
static const char *s_sin[2] = {"sin¹", "csc¹"}; static const char *s_sin_arr[2] = {"sin¯¹", "csc¯¹"};
static const char *s_cos[2] = {"cos¹", "sec¹"}; static const char *s_cos_arr[2] = {"cos¯¹", "sec¯¹"};
static const char *s_tan[2] = {"tan¹", "cot¹"}; static const char *s_tan_arr[2] = {"tan¯¹", "cot¯¹"};
static const char *s_sin;
static const char *s_cos;
static const char *s_tan;
///////////////////////////////// /////////////////////////////////
@@ -384,13 +387,13 @@ static void menu_draw_row(GContext *ctx, const Layer *cell_layer, MenuIndex *cel
case 1: case 1:
switch (cell_index->row) { switch (cell_index->row) {
case 0: case 0:
menu_cell_basic_draw(ctx, cell_layer, s_sin[rand() % 2], NULL, NULL); menu_cell_basic_draw(ctx, cell_layer, s_sin, NULL, NULL);
break; break;
case 1: case 1:
menu_cell_basic_draw(ctx, cell_layer, s_cos[rand() % 2], NULL, NULL); menu_cell_basic_draw(ctx, cell_layer, s_cos, NULL, NULL);
break; break;
case 2: case 2:
menu_cell_basic_draw(ctx, cell_layer, s_tan[rand() % 2], NULL, NULL); menu_cell_basic_draw(ctx, cell_layer, s_tan, NULL, NULL);
} }
break; break;
case 2: case 2:
@@ -434,8 +437,17 @@ static void drop_menu_window_unload(Window *window) {
} }
static void alarm_window_load() { static void alarm_window_load() {
s_setter_highlight_color = s_primary_color;
Layer *window_layer = window_get_root_layer(s_window); Layer *window_layer = window_get_root_layer(s_window);
// change highlight color to avoid changing color of bottom bar
s_setter_highlight_color = s_primary_color;
// determine trigonometric function options
s_sin = s_sin_arr[rand() % 2];
s_cos = s_cos_arr[rand() % 2];
s_tan = s_tan_arr[rand() % 2];
// drop window
s_drop_window = window_create(); // TODO destroy on window unload? s_drop_window = window_create(); // TODO destroy on window unload?
window_set_window_handlers( window_set_window_handlers(
s_drop_window, s_drop_window,