Made color buttons smaller

This commit is contained in:
Yousef Khadadeh 2025-11-24 18:23:53 +03:00
parent 0e08b9576d
commit 99983daa65
5 changed files with 37 additions and 31 deletions

View file

@ -22,20 +22,16 @@ bool EllipseDrawEditTool::edit_gui(const std::shared_ptr<DrawComponent>& comp) {
if(t.gui.radio_button_field("filloutline", "Fill and Outline", a->d.fillStrokeMode == 2)) a->d.fillStrokeMode = 2;
if(a->d.fillStrokeMode == 0 || a->d.fillStrokeMode == 2) {
t.gui.left_to_right_line_layout([&]() {
CLAY({.layout = {.sizing = {.width = CLAY_SIZING_FIXED(40), .height = CLAY_SIZING_FIXED(40)}}}) {
if(t.gui.color_button("Fill Color", &a->d.fillColor, &a->d.fillColor == t.colorRight))
t.color_selector_right(&a->d.fillColor == t.colorRight ? nullptr : &a->d.fillColor);
}
if(t.gui.color_button_big("Fill Color", &a->d.fillColor, &a->d.fillColor == t.colorRight))
t.color_selector_right(&a->d.fillColor == t.colorRight ? nullptr : &a->d.fillColor);
t.gui.text_label("Fill Color");
});
}
if(a->d.fillStrokeMode == 1 || a->d.fillStrokeMode == 2) {
t.gui.slider_scalar_field("relstrokewidth", "Outline Size", &a->d.strokeWidth, 3.0f, 40.0f);
t.gui.left_to_right_line_layout([&]() {
CLAY({.layout = {.sizing = {.width = CLAY_SIZING_FIXED(40), .height = CLAY_SIZING_FIXED(40)}}}) {
if(t.gui.color_button("Outline Color", &a->d.strokeColor, &a->d.strokeColor == t.colorRight))
t.color_selector_right(&a->d.strokeColor == t.colorRight ? nullptr : &a->d.strokeColor);
}
if(t.gui.color_button_big("Outline Color", &a->d.strokeColor, &a->d.strokeColor == t.colorRight))
t.color_selector_right(&a->d.strokeColor == t.colorRight ? nullptr : &a->d.strokeColor);
t.gui.text_label("Outline Color");
});
}

View file

@ -56,10 +56,8 @@ void GridModifyTool::gui_toolbox() {
t.gui.checkbox_field("Subdivide outwards", "Subdivide when zooming out", &divOut);
g.set_remove_divisions_outwards(divOut);
t.gui.left_to_right_line_layout([&]() {
CLAY({.layout = {.sizing = {.width = CLAY_SIZING_FIXED(40), .height = CLAY_SIZING_FIXED(40)}}}) {
if(t.gui.color_button("Grid Color", &g.color, &g.color == t.colorRight))
t.color_selector_right(&g.color == t.colorRight ? nullptr : &g.color);
}
if(t.gui.color_button_big("Grid Color", &g.color, &g.color == t.colorRight))
t.color_selector_right(&g.color == t.colorRight ? nullptr : &g.color);
t.gui.text_label("Grid Color");
});
bool bounded = g.bounds.has_value();

View file

@ -20,20 +20,16 @@ bool RectDrawEditTool::edit_gui(const std::shared_ptr<DrawComponent>& comp) {
if(t.gui.radio_button_field("filloutline", "Fill and Outline", a->d.fillStrokeMode == 2)) a->d.fillStrokeMode = 2;
if(a->d.fillStrokeMode == 0 || a->d.fillStrokeMode == 2) {
t.gui.left_to_right_line_layout([&]() {
CLAY({.layout = {.sizing = {.width = CLAY_SIZING_FIXED(40), .height = CLAY_SIZING_FIXED(40)}}}) {
if(t.gui.color_button("Fill Color", &a->d.fillColor, &a->d.fillColor == t.colorRight))
t.color_selector_right(&a->d.fillColor == t.colorRight ? nullptr : &a->d.fillColor);
}
if(t.gui.color_button_big("Fill Color", &a->d.fillColor, &a->d.fillColor == t.colorRight))
t.color_selector_right(&a->d.fillColor == t.colorRight ? nullptr : &a->d.fillColor);
t.gui.text_label("Fill Color");
});
}
if(a->d.fillStrokeMode == 1 || a->d.fillStrokeMode == 2) {
t.gui.slider_scalar_field("relstrokewidth", "Outline Size", &a->d.strokeWidth, 3.0f, 40.0f);
t.gui.left_to_right_line_layout([&]() {
CLAY({.layout = {.sizing = {.width = CLAY_SIZING_FIXED(40), .height = CLAY_SIZING_FIXED(40)}}}) {
if(t.gui.color_button("Outline Color", &a->d.strokeColor, &a->d.strokeColor == t.colorRight))
t.color_selector_right(&a->d.strokeColor == t.colorRight ? nullptr : &a->d.strokeColor);
}
if(t.gui.color_button_big("Outline Color", &a->d.strokeColor, &a->d.strokeColor == t.colorRight))
t.color_selector_right(&a->d.strokeColor == t.colorRight ? nullptr : &a->d.strokeColor);
t.gui.text_label("Outline Color");
});
}

View file

@ -92,10 +92,8 @@ bool TextBoxEditTool::edit_gui(const std::shared_ptr<DrawComponent>& comp) {
// Text color
t.gui.left_to_right_line_layout([&]() {
CLAY({.layout = {.sizing = {.width = CLAY_SIZING_FIXED(40), .height = CLAY_SIZING_FIXED(40)}}}) {
if(t.gui.color_button("Text Color", &newTextColor, &newTextColor == t.colorRight))
t.color_selector_right(&newTextColor == t.colorRight ? nullptr : &newTextColor);
}
if(t.gui.color_button_big("Text Color", &newTextColor, &newTextColor == t.colorRight))
t.color_selector_right(&newTextColor == t.colorRight ? nullptr : &newTextColor);
t.gui.text_label("Text Color");
});
@ -113,21 +111,22 @@ bool TextBoxEditTool::edit_gui(const std::shared_ptr<DrawComponent>& comp) {
// Highlight color
t.gui.left_to_right_line_layout([&]() {
CLAY({.layout = {.sizing = {.width = CLAY_SIZING_FIXED(40), .height = CLAY_SIZING_FIXED(40)}}}) {
if(t.gui.color_button("Highlight Color", &newHighlightColor, &newHighlightColor == t.colorRight)) {
if(newHighlightColor.w() == 0.0f) // Make highlight appear when the button is pressed
newHighlightColor.w() = 1.0f;
t.color_selector_right(&newHighlightColor == t.colorRight ? nullptr : &newHighlightColor);
if(t.gui.color_button_big("Highlight Color", &newHighlightColor, &newHighlightColor == t.colorRight)) {
if(newHighlightColor.w() == 0.0f) { // Make highlight appear when the button is pressed
newHighlightColor.w() = 1.0f;
currentMods[TextStyleModifier::ModifierType::HIGHLIGHT_COLOR] = std::make_shared<HighlightColorTextStyleModifier>(newHighlightColor);
add_undo_if_selecting_area(a, [&]() {a->textBox->set_text_style_modifier_between(a->cursor->selectionBeginPos, a->cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::HIGHLIGHT_COLOR]);});
}
t.color_selector_right(&newHighlightColor == t.colorRight ? nullptr : &newHighlightColor);
}
t.gui.text_label("Highlight Color");
if(newHighlightColor.w() != 0.0f) {
if(t.gui.svg_icon_button("Remove Highlight Color", "data/icons/close.svg")) {
newHighlightColor = Vector4f{0.0f, 0.0f, 0.0f, 0.0f};
newHighlightColor = {0.0f, 0.0f, 0.0f, 0.0f};
currentMods[TextStyleModifier::ModifierType::HIGHLIGHT_COLOR] = std::make_shared<HighlightColorTextStyleModifier>(newHighlightColor);
add_undo_if_selecting_area(a, [&]() {a->textBox->set_text_style_modifier_between(a->cursor->selectionBeginPos, a->cursor->selectionEndPos, currentMods[TextStyleModifier::ModifierType::HIGHLIGHT_COLOR]);});
}
}
t.gui.text_label("Highlight Color");
});
if(&newHighlightColor == t.colorRight)