Free memory from unused GUI elements, and make colorpicker not glitch on first appearance

This commit is contained in:
Yousef Khadadeh 2025-10-14 12:51:24 +03:00
parent 1ec7c717b2
commit 9ceb4e1b8a
4 changed files with 15 additions and 3 deletions

View file

@ -13,7 +13,7 @@ void CheckBox::update(UpdateInputData& io, bool newIsTicked, const std::function
}) {
selection.update(Clay_Hovered(), io.mouse.leftClick, io.mouse.leftHeld);
if(isTicked != newIsTicked) {
hoverAnimation2 = CHECKBOX_ANIMATION_TIME;
hoverAnimation2 = selection.hovered ? CHECKBOX_ANIMATION_TIME : 0.0f;
isTicked = newIsTicked;
}
if(elemUpdate)

View file

@ -22,8 +22,9 @@ template <typename T> class ColorPicker : public Element {
CLAY({
.layout = {
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIXED(bb.width()) }
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0) }
},
.aspectRatio = 1.0f,
.custom = { .customData = this }
}) {
selection.update(Clay_Hovered(), io.mouse.leftClick, io.mouse.leftHeld);