summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadVPN/Views/IncreasedHitButton.swift
blob: e3a79838d6379a39dbab5c0ae678749e8bcc94f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//
//  IncreasedHitButton.swift
//  MullvadVPN
//
//  Created by Mojgan on 2023-05-16.
//  Copyright © 2023 Mullvad VPN AB. All rights reserved.
//

import UIKit

final class IncreasedHitButton: UIButton {
    private let defaultSize = UIMetrics.Button.barButtonSize

    override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
        let width = bounds.width
        let height = bounds.height
        let dx = (max(defaultSize, width) - width) * 0.5
        let dy = (max(defaultSize, height) - height) * 0.5
        return bounds.insetBy(dx: -dx, dy: -dy).contains(point)
    }
}