2021-09-15 20:18:19 +08:00
|
|
|
//
|
|
|
|
// CircleAvatarButton.swift
|
|
|
|
// Mastodon
|
|
|
|
//
|
|
|
|
// Created by Cirno MainasuK on 2021-9-15.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
2023-03-01 08:58:12 -05:00
|
|
|
import Combine
|
2021-09-15 20:18:19 +08:00
|
|
|
|
2022-01-27 21:23:39 +08:00
|
|
|
public final class CircleAvatarButton: AvatarButton {
|
2021-09-15 20:18:19 +08:00
|
|
|
|
2022-01-27 21:23:39 +08:00
|
|
|
@Published public var needsHighlighted = false
|
2021-11-04 15:21:12 +08:00
|
|
|
|
2022-01-27 21:23:39 +08:00
|
|
|
public var borderColor: UIColor = UIColor.systemFill
|
2023-03-20 08:45:28 +01:00
|
|
|
public var borderWidth: CGFloat = 2.0
|
2024-05-21 17:43:53 +02:00
|
|
|
|
|
|
|
public init() {
|
|
|
|
super.init(avatarPlaceholder: .placeholder(color: .systemFill))
|
|
|
|
}
|
|
|
|
|
|
|
|
public required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented")}
|
2021-10-28 19:17:41 +08:00
|
|
|
|
2022-01-27 21:23:39 +08:00
|
|
|
public override func updateAppearance() {
|
2021-11-04 15:21:12 +08:00
|
|
|
super.updateAppearance()
|
2021-09-15 20:18:19 +08:00
|
|
|
|
|
|
|
layer.masksToBounds = true
|
|
|
|
layer.cornerRadius = frame.width * 0.5
|
2021-11-04 15:21:12 +08:00
|
|
|
layer.borderColor = borderColor.cgColor
|
2021-10-28 19:17:41 +08:00
|
|
|
layer.borderWidth = borderWidth
|
2021-09-15 20:18:19 +08:00
|
|
|
}
|
2021-11-04 15:21:12 +08:00
|
|
|
|
2021-09-15 20:18:19 +08:00
|
|
|
}
|