Incorrect layout when using both left & right margin?
https://github.com/delight-dev/Delight/blob/698e660073ff492d0091571fc9a311f62e37a73c/UnityProject/Delight/Assets/Delight/Content/Views/UI/UIView.cs#L408
Should RectTransform.offsetMax actually read like this instead?
RectTransform.offsetMax = new Vector2( offsetMaxX + margin.Left.Pixels - margin.Right.Pixels + offset.Left.Pixels - offset.Right.Pixels + offsetFromParent.Left.Pixels - offsetFromParent.Right.Pixels, offsetMaxY + margin.Bottom.Pixels - margin.Top.Pixels - offset.Top.Pixels + offset.Bottom.Pixels - offsetFromParent.Top.Pixels + offsetFromParent.Bottom.Pixels);
As in, adding margin.Left.Pixels and margin.Bottom.Pixels, otherwise setting a left margin on a rect with a fixed size within a group shrinks it instead of moving to the right.
Example:
<Group Id="MainMenu" Alignment="Left" Orientation="Horizontal" Width="300" Height="100%"> <Region Id="Meme" BackgroundColor="Red" Width="10" Height="100%" Alignment="Left" Margin="105,0,0,0"/> </Group>
Hmm it breaks the case where Width=100%. For that to work, I'm guessing the percentage should be applied after the margin is computed.
Which ... I guess you can't do because UpdateRectTransform doesn't have the size of the parent as an argument