fix djui join message panel back

This commit is contained in:
Isaac0-dev 2025-01-09 14:59:45 +10:00
parent 08a2490954
commit ea65bb06f9
2 changed files with 11 additions and 4 deletions

View file

@ -4,10 +4,11 @@
static void djui_button_update_style(struct DjuiBase* base) {
struct DjuiButton* button = (struct DjuiButton*)base;
struct DjuiTheme* theme = gDjuiThemes[configDjuiTheme];
bool backButton = button->style == DJUI_BUTTON_STYLE_BACK;
if (!button->base.enabled) {
struct DjuiColor bc = djui_theme_shade_color(theme->interactables.defaultBorderColor, button->style ? 0.3f : 0.6f);
struct DjuiColor rc = djui_theme_shade_color(theme->interactables.defaultRectColor, button->style ? 0.3f : 0.6f);
struct DjuiColor bc = djui_theme_shade_color(theme->interactables.defaultBorderColor, backButton ? 0.3f : 0.6f);
struct DjuiColor rc = djui_theme_shade_color(theme->interactables.defaultRectColor, backButton ? 0.3f : 0.6f);
djui_base_set_border_color(base, bc.r, bc.g, bc.b, bc.a);
djui_base_set_color(&button->rect->base, rc.r, rc.g, rc.b, rc.a);
@ -27,8 +28,8 @@ static void djui_button_update_style(struct DjuiBase* base) {
djui_base_set_color(&button->rect->base, rc.r, rc.g, rc.b, rc.a);
djui_base_set_location(&button->text->base, -1.0f, -1.0f);
} else {
struct DjuiColor bc = button->style ? djui_theme_shade_color(theme->interactables.defaultBorderColor, 0.6f) : theme->interactables.defaultBorderColor;
struct DjuiColor rc = button->style ? djui_theme_shade_color(theme->interactables.defaultRectColor, 0.6f) : theme->interactables.defaultRectColor;
struct DjuiColor bc = backButton ? djui_theme_shade_color(theme->interactables.defaultBorderColor, 0.6f) : theme->interactables.defaultBorderColor;
struct DjuiColor rc = backButton ? djui_theme_shade_color(theme->interactables.defaultRectColor, 0.6f) : theme->interactables.defaultRectColor;
djui_base_set_border_color(base, bc.r, bc.g, bc.b, bc.a);
djui_base_set_color(&button->rect->base, rc.r, rc.g, rc.b, rc.a);

View file

@ -30,6 +30,11 @@ void djui_panel_join_message_cancel(struct DjuiBase* caller) {
djui_panel_menu_back(caller);
}
bool djui_panel_join_message_back(struct DjuiBase* caller) {
djui_panel_join_message_cancel(caller);
return true;
}
void djui_panel_join_message_render_pre(struct DjuiBase* base, UNUSED bool* unused) {
if (sDisplayingError) { return; }
struct DjuiText* text1 = (struct DjuiText*)base;
@ -75,6 +80,7 @@ void djui_panel_join_message_create(struct DjuiBase* caller) {
djui_button_create(body, DLANG(MENU, CANCEL), DJUI_BUTTON_STYLE_BACK, djui_panel_join_message_cancel);
}
panel->on_back = djui_panel_join_message_back;
djui_panel_add(caller, panel, NULL);
gDjuiPanelJoinMessageVisible = true;