mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-23 22:53:43 +00:00
[ios] Expand circle buttons tappable area
By 5pt to not overlap with another buttons (`close` and `share` on the place page screen) Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
This commit is contained in:
committed by
Konstantin Pastbin
parent
87cb0307cf
commit
927299f4a9
@@ -1,5 +1,7 @@
|
||||
final class CircleImageButton: UIButton {
|
||||
|
||||
private static let expandedTappableAreaInsets = UIEdgeInsets(top: -5, left: -5, bottom: -5, right: -5)
|
||||
|
||||
private let circleImageView = UIImageView()
|
||||
|
||||
override init(frame: CGRect) {
|
||||
@@ -46,6 +48,11 @@ final class CircleImageButton: UIButton {
|
||||
circleImageView.layer.cornerRadius = circleImageView.bounds.width / 2.0
|
||||
}
|
||||
|
||||
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
|
||||
let expandedBounds = bounds.inset(by: Self.expandedTappableAreaInsets)
|
||||
return expandedBounds.contains(point)
|
||||
}
|
||||
|
||||
func setImage(_ image: UIImage?) {
|
||||
circleImageView.image = image
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user