diff --git a/App/Common UI/ReliefButton.swift b/App/Common UI/ReliefButton.swift index 00e1a7e..8d44ae3 100644 --- a/App/Common UI/ReliefButton.swift +++ b/App/Common UI/ReliefButton.swift @@ -70,6 +70,11 @@ class ReliefButton: UIButton addSubview(backgroundView) traitCollectionDidChange(nil) + + pointerStyleProvider = { (button, pointerEffect, pointerShape) -> UIPointerStyle? in + let preview = UITargetedPreview(view: button) + return UIPointerStyle(effect: .lift(preview), shape: pointerShape) + } } required init?(coder: NSCoder) { diff --git a/App/Common UI/SegmentedReliefButton.swift b/App/Common UI/SegmentedReliefButton.swift index 9fcd2aa..a12c694 100644 --- a/App/Common UI/SegmentedReliefButton.swift +++ b/App/Common UI/SegmentedReliefButton.swift @@ -14,6 +14,11 @@ class SegmentedReliefButton: ReliefButton didSet { children.forEach { addSubview($0) }; setNeedsLayout() } } + override var isPointerInteractionEnabled: Bool { + set { children.forEach { $0.isPointerInteractionEnabled = newValue } } + get { children.first?.isPointerInteractionEnabled ?? false } + } + private let backgroundsContainerView = UIView(frame: .zero) private var childrenHighlighObservations: [NSKeyValueObservation] = [] @@ -30,7 +35,8 @@ class SegmentedReliefButton: ReliefButton } override var isHighlighted: Bool { - didSet {} + // Does not highlight. Only children do. + set {} get { false } } required init?(coder: NSCoder) { diff --git a/App/Tabs/TabBarView.swift b/App/Tabs/TabBarView.swift index ceb8403..1fdaed2 100644 --- a/App/Tabs/TabBarView.swift +++ b/App/Tabs/TabBarView.swift @@ -29,6 +29,7 @@ class TabView: UIControl addSubview(closeButton) closeButton.setImage(UIImage(systemName: "xmark.square.fill"), for: .normal) + closeButton.isPointerInteractionEnabled = true closeButton.imageView?.contentMode = .center closeButton.tintColor = .label diff --git a/App/Titlebar and URL Bar/ToolbarButtonContainerView.swift b/App/Titlebar and URL Bar/ToolbarButtonContainerView.swift index 2af469e..b886358 100644 --- a/App/Titlebar and URL Bar/ToolbarButtonContainerView.swift +++ b/App/Titlebar and URL Bar/ToolbarButtonContainerView.swift @@ -14,6 +14,10 @@ class ToolbarButtonContainerView: UIView public var numberOfButtonViews: Int { buttonViews.count } func addButtonView(_ button: UIView) { + if let asButton = button as? UIButton { + asButton.isPointerInteractionEnabled = true + } + buttonViews.append(button) addSubview(button) setNeedsLayout() diff --git a/App/Titlebar and URL Bar/URLBar.swift b/App/Titlebar and URL Bar/URLBar.swift index b65ae4c..4366f57 100644 --- a/App/Titlebar and URL Bar/URLBar.swift +++ b/App/Titlebar and URL Bar/URLBar.swift @@ -40,6 +40,10 @@ class URLBar: ReliefButton didSet { updateProgressIndicator() } } + override var isPointerInteractionEnabled: Bool { + get { false } set {} + } + private let fadeMaskView = UIImageView(frame: .zero) private let progressIndicatorView = ProgressIndicatorView() @@ -84,6 +88,7 @@ class URLBar: ReliefButton refreshButton.tintColor = .secondaryLabel refreshButton.setImage(refreshImage, for: .normal) + refreshButton.isPointerInteractionEnabled = true addSubview(refreshButton) errorButton.backgroundColor = .systemRed @@ -92,10 +97,12 @@ class URLBar: ReliefButton errorButton.titleLabel?.font = UIFont.boldSystemFont(ofSize: 11.0) errorButton.setTitleColor(.white, for: .normal) errorButton.setTitle("ERR", for: .normal) + errorButton.isPointerInteractionEnabled = true addSubview(errorButton) documentButton.tintColor = .secondaryLabel documentButton.setImage(documentImage, for: .normal) + documentButton.isPointerInteractionEnabled = true addSubview(documentButton) documentSeparatorView.backgroundColor = .secondarySystemFill @@ -155,6 +162,10 @@ class URLBar: ReliefButton self.setNeedsLayout() } + override func setBackgroundInverted(_ inverted: Bool) { + // no-op + } + override var intrinsicContentSize: CGSize { let preferredHeight = CGFloat(34) return CGSize(width: 1000.0, height: preferredHeight)