Skip to content

Include trailing edge offsets in autoSizeThatFits - #285

Open
heoblitz wants to merge 2 commits into
layoutBox:masterfrom
heoblitz:fix/issue-276
Open

Include trailing edge offsets in autoSizeThatFits#285
heoblitz wants to merge 2 commits into
layoutBox:masterfrom
heoblitz:fix/issue-276

Conversation

@heoblitz

@heoblitz heoblitz commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

What is this PR?

Fix autoSizeThatFits so trailing and bottom edge offsets are included in the calculated size.

Closes #276

Reproduction

private func performPinLayout() {
    view1.pin.size(50).start(16).top(16).bottom(16)
    view2.pin.size(50).top(16).end(16).bottom(16)
}

override func layoutSubviews() {
    super.layoutSubviews()
    performPinLayout()
}

override func sizeThatFits(_ size: CGSize) -> CGSize {
    autoSizeThatFits(size, layoutClosure: performPinLayout)
}

sizeThatFits now returns the expected height of 82.

Tests

  • LTR and RTL auto sizing, followed by actual frame placement
  • Negative leading offsets remain unchanged
  • LayoutMethodSpec passes
Issue #276 reproduction

@heoblitz
heoblitz marked this pull request as ready for review August 8, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edge offsets (.top(x), .bottom(x), .start(x), .end(x)) aren't used in autoSizeThatFits

1 participant