Fixed cursor obstruction issues and hiding main menu popup issues

This commit is contained in:
Yousef Khadadeh 2026-03-31 18:41:19 +03:00
parent 16c3097534
commit ed36036aea
21 changed files with 124 additions and 141 deletions

View file

@ -6,13 +6,19 @@ namespace GUIStuff { namespace ElementHelpers {
void text_button(GUIManager& gui, const char* id, std::string_view text, const TextButtonOptions& options) {
SelectableButton::Data d = selectable_button_options_to_data(options);
d.innerContent = [&gui, text] (const SelectableButton::InnerContentCallbackParameters&) {
text_label(gui, text);
d.innerContent = [&gui, text, centered = options.centered] (const SelectableButton::InnerContentCallbackParameters&) {
CLAY_AUTO_ID({
.layout = {
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0) },
.childAlignment = {.x = centered ? CLAY_ALIGN_X_CENTER : CLAY_ALIGN_X_LEFT, .y = CLAY_ALIGN_Y_CENTER}
}
}) {
text_label(gui, text);
}
};
CLAY_AUTO_ID({
.layout = {
.sizing = {.width = options.wide ? CLAY_SIZING_GROW(0) : CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIT(0) },
.childAlignment = {.x = options.centered ? CLAY_ALIGN_X_CENTER : CLAY_ALIGN_X_LEFT, .y = CLAY_ALIGN_Y_CENTER}
.sizing = {.width = options.wide ? CLAY_SIZING_GROW(0) : CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIT(0) }
}
}) {
gui.element<SelectableButton>(id, d);

View file

@ -69,7 +69,7 @@ template <typename T> bool TextBox<T>::input_mouse_button_callback(const InputMa
textbox->process_mouse_left_button(*cur, button.pos - boundingBox.value().min, button.clicks, true, gui.io.input->key(InputManager::KEY_TEXT_SHIFT).held);
isSelected = true;
}
else {
else if(isSelected) {
gui.io.input->remove_rich_text_box_input(textbox);
if(update_data())
gui.set_post_callback_func(userInfo.onEdit);

View file

@ -237,7 +237,7 @@ void GUIManager::set_to_layout() {
void GUIManager::layout_if_necessary() {
if(setToLayout) {
layout();
setToLayout = true;
setToLayout = false;
}
}