Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Editor Bar Manager - Add opacity change to custom buttom on pressed
  • Loading branch information
Gerardo committed Jun 29, 2023
commit 47a6626585c14807dd9218b6f1b5012d7d25074e
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ protocol PostEditorNavigationBarManagerDelegate: AnyObject {
class ExtendedTouchAreaButton: UIButton {
private var touchAreaPadding: CGFloat = 24.0

override var isHighlighted: Bool {
didSet {
UIView.animate(withDuration: 0.2) {
self.alpha = self.isHighlighted ? 0.5 : 1.0
}
}
}

override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
let extendedArea = bounds.insetBy(dx: -touchAreaPadding, dy: -touchAreaPadding)
return extendedArea.contains(point)
Expand Down Expand Up @@ -59,7 +67,7 @@ class PostEditorNavigationBarManager {
}()

lazy var closeButtonContainer: ExtendedTouchAreaButton = {
let button = ExtendedTouchAreaButton(type: .system)
let button = ExtendedTouchAreaButton(type: .custom)
button.translatesAutoresizingMaskIntoConstraints = false
button.accessibilityIdentifier = "editor-close-button"
button.accessibilityLabel = NSLocalizedString("Close", comment: "Action button to close the editor")
Expand Down