mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 17:48:19 +00:00
Merge pull request #8120 from Robyt3/UI-Color-Picker-Line-Improvement
Support clicking line color picker label to toggle checkbox
This commit is contained in:
commit
47d77fad07
|
@ -380,27 +380,27 @@ ColorHSLA CMenus::DoLine_ColorPicker(CButtonContainer *pResetId, const float Lin
|
||||||
pMainRect->HSplitTop(LineSize, &Section, pMainRect);
|
pMainRect->HSplitTop(LineSize, &Section, pMainRect);
|
||||||
pMainRect->HSplitTop(BottomMargin, nullptr, pMainRect);
|
pMainRect->HSplitTop(BottomMargin, nullptr, pMainRect);
|
||||||
|
|
||||||
if(CheckBoxSpacing || pCheckBoxValue != nullptr)
|
|
||||||
{
|
|
||||||
CUIRect CheckBox;
|
|
||||||
Section.VSplitLeft(Section.h, &CheckBox, &Section);
|
|
||||||
if(pCheckBoxValue != nullptr)
|
|
||||||
{
|
|
||||||
CheckBox.Margin(2.0f, &CheckBox);
|
|
||||||
if(DoButton_CheckBox(pCheckBoxValue, "", *pCheckBoxValue, &CheckBox))
|
|
||||||
*pCheckBoxValue ^= 1;
|
|
||||||
}
|
|
||||||
Section.VSplitLeft(5.0f, nullptr, &Section);
|
|
||||||
}
|
|
||||||
|
|
||||||
Section.VSplitRight(88.0f, &Label, &Section);
|
|
||||||
Section.VSplitRight(60.0f, &Section, &ResetButton);
|
Section.VSplitRight(60.0f, &Section, &ResetButton);
|
||||||
Section.VSplitRight(8.0f, &Section, nullptr);
|
Section.VSplitRight(8.0f, &Section, nullptr);
|
||||||
Section.VSplitRight(Section.h, &Section, &ColorPickerButton);
|
Section.VSplitRight(Section.h, &Section, &ColorPickerButton);
|
||||||
|
Section.VSplitRight(8.0f, &Label, nullptr);
|
||||||
|
|
||||||
Ui()->DoLabel(&Label, pText, LabelSize, TEXTALIGN_ML);
|
if(pCheckBoxValue != nullptr)
|
||||||
|
{
|
||||||
|
Label.Margin(2.0f, &Label);
|
||||||
|
if(DoButton_CheckBox(pCheckBoxValue, pText, *pCheckBoxValue, &Label))
|
||||||
|
*pCheckBoxValue ^= 1;
|
||||||
|
}
|
||||||
|
else if(CheckBoxSpacing)
|
||||||
|
{
|
||||||
|
Label.VSplitLeft(Label.h + 5.0f, nullptr, &Label);
|
||||||
|
}
|
||||||
|
if(pCheckBoxValue == nullptr)
|
||||||
|
{
|
||||||
|
Ui()->DoLabel(&Label, pText, LabelSize, TEXTALIGN_ML);
|
||||||
|
}
|
||||||
|
|
||||||
ColorHSLA PickedColor = DoButton_ColorPicker(&ColorPickerButton, pColorValue, Alpha);
|
const ColorHSLA PickedColor = DoButton_ColorPicker(&ColorPickerButton, pColorValue, Alpha);
|
||||||
|
|
||||||
ResetButton.HMargin(2.0f, &ResetButton);
|
ResetButton.HMargin(2.0f, &ResetButton);
|
||||||
if(DoButton_Menu(pResetId, Localize("Reset"), 0, &ResetButton, nullptr, IGraphics::CORNER_ALL, 4.0f, 0.1f, ColorRGBA(1.0f, 1.0f, 1.0f, 0.25f)))
|
if(DoButton_Menu(pResetId, Localize("Reset"), 0, &ResetButton, nullptr, IGraphics::CORNER_ALL, 4.0f, 0.1f, ColorRGBA(1.0f, 1.0f, 1.0f, 0.25f)))
|
||||||
|
|
Loading…
Reference in a new issue