Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 footnote icons layout #785

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,15 @@ struct FootnoteIconsHStack: Layout {
for (index, subview) in subviews.enumerated() {
let subviewSize = subview.sizeThatFits(proposal)
maxHeight = max(maxHeight, subviewSize.height)
if subviewSize.width + totalWidth <= contentWidth {
totalWidth += subviewSize.width
totalWidth += self.spacing
let gap = index > 0 ? self.spacing : 0
if totalWidth + subviewSize.width + gap <= contentWidth {
totalWidth += (subviewSize.width + gap)
} else {
cache.count = index
cache.size = CGSize(width: totalWidth, height: maxHeight)
break
return
}
}
totalWidth -= self.spacing
cache.count = subviews.count
cache.size = CGSize(width: totalWidth, height: maxHeight)
}
Expand All @@ -119,7 +118,9 @@ struct FootnoteIconsHStack: Layout {
proposal: ProposedViewSize(CGSize(width: subviewSize.width, height: subviewSize.height)))
xOffset += (subviewSize.width + self.spacing)
} else {
break
let maxOffset = CGFloat.greatestFiniteMagnitude
let offScreen = CGPoint(x: maxOffset, y: maxOffset)
subview.place(at: offScreen, proposal: .unspecified)
}
}
}
Expand Down
Loading