optimise round corner for carousel view
This commit is contained in:
parent
7e164ecf04
commit
2b38862524
|
@ -28,7 +28,8 @@ public class MediaAlbumView: UIStackView {
|
|||
MediaView(
|
||||
mediaCache: mediaCache,
|
||||
attachment: $0,
|
||||
isOutgoing: isOutgoing
|
||||
isOutgoing: isOutgoing,
|
||||
cornerRadius: VisibleMessageCell.largeCornerRadius
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,8 @@ public class MediaView: UIView {
|
|||
public required init(
|
||||
mediaCache: NSCache<NSString, AnyObject>? = nil,
|
||||
attachment: Attachment,
|
||||
isOutgoing: Bool
|
||||
isOutgoing: Bool,
|
||||
cornerRadius: CGFloat
|
||||
) {
|
||||
self.mediaCache = mediaCache
|
||||
self.attachment = attachment
|
||||
|
@ -58,7 +59,7 @@ public class MediaView: UIView {
|
|||
themeBackgroundColor = .backgroundSecondary
|
||||
clipsToBounds = true
|
||||
layer.masksToBounds = true
|
||||
layer.cornerRadius = VisibleMessageCell.largeCornerRadius
|
||||
layer.cornerRadius = cornerRadius
|
||||
|
||||
createContents()
|
||||
}
|
||||
|
|
|
@ -16,7 +16,8 @@ extension MediaInfoVC {
|
|||
private lazy var mediaView: MediaView = {
|
||||
let result: MediaView = MediaView.init(
|
||||
attachment: attachment,
|
||||
isOutgoing: isOutgoing
|
||||
isOutgoing: isOutgoing,
|
||||
cornerRadius: 0
|
||||
)
|
||||
|
||||
return result
|
||||
|
|
|
@ -38,7 +38,8 @@ final class MediaInfoVC: BaseVC {
|
|||
arrowsSize: CGSize(
|
||||
width: 20,
|
||||
height: 30
|
||||
)
|
||||
),
|
||||
cornerRadius: 8
|
||||
)
|
||||
)
|
||||
result.set(.height, to: Self.mediaSize)
|
||||
|
|
|
@ -15,6 +15,7 @@ extension SessionCarouselView {
|
|||
let pageControlStyle: PageControlStyle
|
||||
let shouldShowArrows: Bool
|
||||
let arrowsSize: CGSize
|
||||
let cornerRadius: CGFloat
|
||||
|
||||
// MARK: - Initialization
|
||||
|
||||
|
@ -26,7 +27,8 @@ extension SessionCarouselView {
|
|||
shouldShowPageControl: Bool = true,
|
||||
pageControlStyle: PageControlStyle,
|
||||
shouldShowArrows: Bool = true,
|
||||
arrowsSize: CGSize = .zero
|
||||
arrowsSize: CGSize = .zero,
|
||||
cornerRadius: CGFloat = 0
|
||||
) {
|
||||
self.slices = slices
|
||||
self.copyOfFirstSlice = copyOfFirstSlice
|
||||
|
@ -37,6 +39,7 @@ extension SessionCarouselView {
|
|||
self.pageControlStyle = pageControlStyle
|
||||
self.shouldShowArrows = shouldShowArrows && (self.sliceCount > 1)
|
||||
self.arrowsSize = arrowsSize
|
||||
self.cornerRadius = cornerRadius
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ final class SessionCarouselView: UIView, UIScrollViewDelegate {
|
|||
width: self.info.sliceSize.width * CGFloat(self.slicesForLoop.count),
|
||||
height: self.info.sliceSize.height
|
||||
)
|
||||
result.layer.cornerRadius = self.info.cornerRadius
|
||||
result.layer.masksToBounds = true
|
||||
|
||||
return result
|
||||
}()
|
||||
|
|
Loading…
Reference in New Issue