From 7e18c7a3167fe0cb10689c37eaa9495130d92436 Mon Sep 17 00:00:00 2001 From: Alessandro Mauri Date: Sun, 1 Dec 2024 00:28:08 +0100 Subject: [PATCH] only reset div elements to default if new element --- src/ugui_div.c3 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ugui_div.c3 b/src/ugui_div.c3 index e17b278..1d3f57f 100644 --- a/src/ugui_div.c3 +++ b/src/ugui_div.c3 @@ -20,22 +20,22 @@ fn void! Ctx.div_begin(&ctx, String label, Rect size) c_elem.bounds = ctx.position_element(parent, size); if (c_elem.flags.is_new) { c_elem.div.children_bounds = c_elem.bounds; + c_elem.div.color_bg = uint_to_rgba(0xff0000ff); + c_elem.div.scroll.can_x = false; + c_elem.div.scroll.can_y = false; + c_elem.div.scroll.value_x = 0; + c_elem.div.scroll.value_y = 0; } // 3. Mark the element as updated c_elem.flags.updated = true; // 4. Fill the div fields - c_elem.div.layout = parent.div.layout; c_elem.div.origin_c = Point{ .x = c_elem.bounds.x, .y = c_elem.bounds.y, }; c_elem.div.origin_r = c_elem.div.origin_c; - c_elem.div.color_bg = uint_to_rgba(0xff0000ff); - c_elem.div.scroll.can_x = false; - c_elem.div.scroll.can_y = false; - c_elem.div.scroll.value_x = 0; - c_elem.div.scroll.value_y = 0; + c_elem.div.layout = parent.div.layout; } // Add the background to the draw stack