Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Fixed cell border on merge button #2204

Merged
merged 2 commits into from
Sep 30, 2018
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion Classes/Issues/Merge/IssueMergeSectionController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ ListBindingSectionControllerSelectionDelegate {
else { fatalError() }

if let cell = cell as? CardCollectionViewCell {
cell.border = index == 0 ? .head : index == self.viewModels.count - 1 ? .tail : .neck
cell.border = index == 0
? index == self.viewModels.count - 1 ? .full : .head
: index == self.viewModels.count - 1 ? .tail : .neck
}
if let cell = cell as? IssueMergeButtonCell {
cell.delegate = self
Expand Down
33 changes: 33 additions & 0 deletions Classes/Views/CardCollectionViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class CardCollectionViewCell: UICollectionViewCell, UIGestureRecognizerDelegate
case head
case neck
case tail
case full
}

var border: BorderType = .neck {
Expand Down Expand Up @@ -95,6 +96,36 @@ class CardCollectionViewCell: UICollectionViewCell, UIGestureRecognizerDelegate
)
borderPath.addLine(to: CGPoint(x: pixelSnapBounds.maxX, y: bounds.minY))

fillPath = borderPath.copy() as! UIBezierPath
fillPath.close()
case .full:

borderPath.move(to: CGPoint(x: pixelSnapBounds.minX, y: bounds.maxY - cornerRadius))
borderPath.addLine(to: CGPoint(x: pixelSnapBounds.minX, y: pixelSnapBounds.minY + cornerRadius))

borderPath.addQuadCurve(
to: CGPoint(x: pixelSnapBounds.minX + cornerRadius, y: pixelSnapBounds.minY),
controlPoint: CGPoint(x: pixelSnapBounds.minX, y: pixelSnapBounds.minY)
)
borderPath.addLine(to: CGPoint(x: pixelSnapBounds.maxX - cornerRadius, y: pixelSnapBounds.minY))

borderPath.addQuadCurve(
to: CGPoint(x: pixelSnapBounds.maxX, y: pixelSnapBounds.minY + cornerRadius),
controlPoint: CGPoint(x: pixelSnapBounds.maxX, y: pixelSnapBounds.minY)
)
borderPath.addLine(to: CGPoint(x: pixelSnapBounds.maxX, y: pixelSnapBounds.maxY - cornerRadius))

borderPath.addQuadCurve(
to: CGPoint(x: pixelSnapBounds.maxX - cornerRadius, y: pixelSnapBounds.maxY),
controlPoint: CGPoint(x: pixelSnapBounds.maxX, y: pixelSnapBounds.maxY)
)
borderPath.addLine(to: CGPoint(x: pixelSnapBounds.minX + cornerRadius, y: bounds.maxY))

borderPath.addQuadCurve(
to: CGPoint(x: pixelSnapBounds.minX, y: pixelSnapBounds.maxY - cornerRadius),
controlPoint: CGPoint(x: pixelSnapBounds.minX, y: pixelSnapBounds.maxY)
)

fillPath = borderPath.copy() as! UIBezierPath
fillPath.close()
}
Expand All @@ -114,3 +145,5 @@ class CardCollectionViewCell: UICollectionViewCell, UIGestureRecognizerDelegate
}

}