From 76b5fbe9115d3c653e00eb813f09e18aa4ce13e1 Mon Sep 17 00:00:00 2001 From: tomasklaen Date: Fri, 3 Nov 2023 11:21:45 +0100 Subject: [PATCH] fix: dynamic control shrinking would not subtract spacing ref #740 --- src/uosc/elements/Controls.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/uosc/elements/Controls.lua b/src/uosc/elements/Controls.lua index 7dfd8448..12c8e9c3 100644 --- a/src/uosc/elements/Controls.lua +++ b/src/uosc/elements/Controls.lua @@ -285,8 +285,9 @@ function Controls:update_dimensions() min_content_width = min_content_width + width elseif control.sizing == 'dynamic' then local spacing = (c ~= #self.layout and spacing or 0) + statics_width = statics_width + spacing min_content_width = min_content_width + size * control.scale * control.ratio_min + spacing - max_dynamics_width = max_dynamics_width + size * control.scale * control.ratio + spacing + max_dynamics_width = max_dynamics_width + size * control.scale * control.ratio dynamic_units = dynamic_units + control.scale * control.ratio end end @@ -306,8 +307,9 @@ function Controls:update_dimensions() min_content_width = min_content_width - width - spacing statics_width = statics_width - width - spacing elseif control.sizing == 'dynamic' then + statics_width = statics_width - spacing min_content_width = min_content_width - size * control.scale * control.ratio_min - spacing - max_dynamics_width = max_dynamics_width - size * control.scale * control.ratio - spacing + max_dynamics_width = max_dynamics_width - size * control.scale * control.ratio dynamic_units = dynamic_units - control.scale * control.ratio end