more constants
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
91b0b4415c
commit
178df4ed0a
@ -97,11 +97,15 @@ struct ButtonGroupConstants {
|
||||
}
|
||||
//text link caret
|
||||
else if let _ = primary as? TextLinkCaret {
|
||||
if let _ = neighboring as? TextLinkCaret {
|
||||
return 24.0
|
||||
} else {
|
||||
return defaultSpace
|
||||
}
|
||||
if let neighboringButton = neighboring as? Button, neighboringButton.size == .large {
|
||||
return 16.0
|
||||
} else if let _ = neighboring as? TextLinkCaret {
|
||||
return 24.0
|
||||
} else if let neighboringTextLink = neighboring as? TextLink, neighboringTextLink.size == .large {
|
||||
return 24.0
|
||||
} else {
|
||||
return defaultSpace
|
||||
}
|
||||
}
|
||||
//small button
|
||||
else if let button = primary as? Button, button.size == .small {
|
||||
@ -117,6 +121,8 @@ struct ButtonGroupConstants {
|
||||
else if let textLink = primary as? TextLink, textLink.size == .small {
|
||||
if let neighboringTextLink = neighboring as? TextLink, neighboringTextLink.size == .small {
|
||||
return 32.0
|
||||
} else if let neighboringButton = neighboring as? Button, neighboringButton.size == .small {
|
||||
return 24.0
|
||||
} else {
|
||||
return defaultSpace
|
||||
}
|
||||
|
||||
@ -32,6 +32,11 @@ class ButtonCollectionViewRow {
|
||||
attributes.compactMap{$0.frame.height}.max() ?? 0
|
||||
}
|
||||
|
||||
var maxHeightIndexPath: IndexPath {
|
||||
let maxHeight = rowHeight
|
||||
return attributes.first(where: {$0.frame.height == maxHeight})!.indexPath
|
||||
}
|
||||
|
||||
var rowY: CGFloat = 0 {
|
||||
didSet {
|
||||
for attribute in attributes {
|
||||
@ -179,10 +184,7 @@ class ButtonGroupPositionLayout: UICollectionViewLayout {
|
||||
}
|
||||
|
||||
layoutWidthIterator = 0.0
|
||||
|
||||
// recalculate rows x based off of positions
|
||||
rows.forEach { $0.layout(for: position, with: collectionViewWidth) }
|
||||
|
||||
|
||||
// calculate the
|
||||
layoutHeight = 0.0
|
||||
|
||||
@ -194,7 +196,7 @@ class ButtonGroupPositionLayout: UICollectionViewLayout {
|
||||
var rowSpacing = 0.0
|
||||
|
||||
if item > 0 {
|
||||
rowSpacing = row.hasButtons ? ButtonGroupConstants.rowSpacingButton : ButtonGroupConstants.rowSpacingTextLink
|
||||
rowSpacing = 12.0
|
||||
row.rowY = layoutHeight + rowSpacing
|
||||
layoutHeight += rowSpacing
|
||||
}
|
||||
@ -202,6 +204,9 @@ class ButtonGroupPositionLayout: UICollectionViewLayout {
|
||||
layoutHeight += row.rowHeight
|
||||
}
|
||||
|
||||
// recalculate rows x based off of positions
|
||||
rows.forEach { $0.layout(for: position, with: collectionViewWidth) }
|
||||
|
||||
let rowAttributes = rows.flatMap { $0.attributes }
|
||||
itemCache = rowAttributes
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user