Skip to content

Commit

Permalink
fix: dynamic control shrinking would not subtract spacing
Browse files Browse the repository at this point in the history
ref #740
  • Loading branch information
tomasklaen committed Nov 3, 2023
1 parent f1c41a5 commit 76b5fbe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/uosc/elements/Controls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 76b5fbe

Please # to comment.