mirror of
https://github.com/metabolist/metatext
synced 2024-12-27 18:22:32 +01:00
Edit icon on attachments
This commit is contained in:
parent
15cc811102
commit
35a90f866c
@ -9,6 +9,7 @@ final class AttachmentView: UIView {
|
||||
let playerView = PlayerView()
|
||||
let imageView = AnimatedImageView()
|
||||
let removeButton = UIButton(type: .close)
|
||||
let editIcon = UIImageView()
|
||||
let selectionButton = UIButton()
|
||||
|
||||
var playing: Bool = false {
|
||||
@ -151,6 +152,15 @@ private extension AttachmentView {
|
||||
self.parentViewModel.removeAttachment(viewModel: self.viewModel)
|
||||
}])
|
||||
|
||||
addSubview(editIcon)
|
||||
editIcon.translatesAutoresizingMaskIntoConstraints = false
|
||||
editIcon.image = UIImage(
|
||||
systemName: "pencil",
|
||||
withConfiguration: UIImage.SymbolConfiguration(scale: .large))
|
||||
editIcon.layer.shadowOffset = .zero
|
||||
editIcon.layer.shadowRadius = .defaultShadowRadius
|
||||
editIcon.layer.shadowOpacity = .defaultShadowOpacity
|
||||
|
||||
switch viewModel.attachment.type {
|
||||
case .image, .video, .gifv:
|
||||
imageView.kf.setImage(
|
||||
@ -196,7 +206,9 @@ private extension AttachmentView {
|
||||
selectionButton.topAnchor.constraint(equalTo: topAnchor),
|
||||
selectionButton.bottomAnchor.constraint(equalTo: bottomAnchor),
|
||||
removeButton.topAnchor.constraint(equalTo: layoutMarginsGuide.topAnchor),
|
||||
removeButton.trailingAnchor.constraint(equalTo: layoutMarginsGuide.trailingAnchor)
|
||||
removeButton.trailingAnchor.constraint(equalTo: layoutMarginsGuide.trailingAnchor),
|
||||
editIcon.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor),
|
||||
editIcon.bottomAnchor.constraint(equalTo: layoutMarginsGuide.bottomAnchor)
|
||||
])
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ private extension EditThumbnailView {
|
||||
previewImageContainerView.layer.cornerRadius = .defaultCornerRadius
|
||||
previewImageContainerView.layer.shadowOffset = .zero
|
||||
previewImageContainerView.layer.shadowRadius = .defaultShadowRadius
|
||||
previewImageContainerView.layer.shadowOpacity = 0.25
|
||||
previewImageContainerView.layer.shadowOpacity = .defaultShadowOpacity
|
||||
|
||||
previewImageContainerView.addSubview(previewImageView)
|
||||
previewImageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
@ -37,7 +37,7 @@ private extension NewStatusButtonView {
|
||||
.cgPath
|
||||
layer.shadowOffset = .zero
|
||||
layer.shadowRadius = .defaultShadowRadius
|
||||
layer.shadowOpacity = 0.25
|
||||
layer.shadowOpacity = .defaultShadowOpacity
|
||||
|
||||
addSubview(blurView)
|
||||
blurView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
@ -17,6 +17,10 @@ extension CGFloat {
|
||||
static let systemMenuInset: Self = 15
|
||||
}
|
||||
|
||||
extension Float {
|
||||
static let defaultShadowOpacity: Self = 0.25
|
||||
}
|
||||
|
||||
extension CGRect {
|
||||
static let defaultContentsRect = Self(origin: .zero, size: .init(width: 1, height: 1))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user