mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-22 00:01:00 +00:00
Edit icon on attachments
This commit is contained in:
parent
15cc811102
commit
35a90f866c
4 changed files with 19 additions and 3 deletions
|
@ -9,6 +9,7 @@ final class AttachmentView: UIView {
|
||||||
let playerView = PlayerView()
|
let playerView = PlayerView()
|
||||||
let imageView = AnimatedImageView()
|
let imageView = AnimatedImageView()
|
||||||
let removeButton = UIButton(type: .close)
|
let removeButton = UIButton(type: .close)
|
||||||
|
let editIcon = UIImageView()
|
||||||
let selectionButton = UIButton()
|
let selectionButton = UIButton()
|
||||||
|
|
||||||
var playing: Bool = false {
|
var playing: Bool = false {
|
||||||
|
@ -151,6 +152,15 @@ private extension AttachmentView {
|
||||||
self.parentViewModel.removeAttachment(viewModel: self.viewModel)
|
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 {
|
switch viewModel.attachment.type {
|
||||||
case .image, .video, .gifv:
|
case .image, .video, .gifv:
|
||||||
imageView.kf.setImage(
|
imageView.kf.setImage(
|
||||||
|
@ -196,7 +206,9 @@ private extension AttachmentView {
|
||||||
selectionButton.topAnchor.constraint(equalTo: topAnchor),
|
selectionButton.topAnchor.constraint(equalTo: topAnchor),
|
||||||
selectionButton.bottomAnchor.constraint(equalTo: bottomAnchor),
|
selectionButton.bottomAnchor.constraint(equalTo: bottomAnchor),
|
||||||
removeButton.topAnchor.constraint(equalTo: layoutMarginsGuide.topAnchor),
|
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.cornerRadius = .defaultCornerRadius
|
||||||
previewImageContainerView.layer.shadowOffset = .zero
|
previewImageContainerView.layer.shadowOffset = .zero
|
||||||
previewImageContainerView.layer.shadowRadius = .defaultShadowRadius
|
previewImageContainerView.layer.shadowRadius = .defaultShadowRadius
|
||||||
previewImageContainerView.layer.shadowOpacity = 0.25
|
previewImageContainerView.layer.shadowOpacity = .defaultShadowOpacity
|
||||||
|
|
||||||
previewImageContainerView.addSubview(previewImageView)
|
previewImageContainerView.addSubview(previewImageView)
|
||||||
previewImageView.translatesAutoresizingMaskIntoConstraints = false
|
previewImageView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
|
|
@ -37,7 +37,7 @@ private extension NewStatusButtonView {
|
||||||
.cgPath
|
.cgPath
|
||||||
layer.shadowOffset = .zero
|
layer.shadowOffset = .zero
|
||||||
layer.shadowRadius = .defaultShadowRadius
|
layer.shadowRadius = .defaultShadowRadius
|
||||||
layer.shadowOpacity = 0.25
|
layer.shadowOpacity = .defaultShadowOpacity
|
||||||
|
|
||||||
addSubview(blurView)
|
addSubview(blurView)
|
||||||
blurView.translatesAutoresizingMaskIntoConstraints = false
|
blurView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
|
|
@ -17,6 +17,10 @@ extension CGFloat {
|
||||||
static let systemMenuInset: Self = 15
|
static let systemMenuInset: Self = 15
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension Float {
|
||||||
|
static let defaultShadowOpacity: Self = 0.25
|
||||||
|
}
|
||||||
|
|
||||||
extension CGRect {
|
extension CGRect {
|
||||||
static let defaultContentsRect = Self(origin: .zero, size: .init(width: 1, height: 1))
|
static let defaultContentsRect = Self(origin: .zero, size: .init(width: 1, height: 1))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue