mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-11 09:28:38 +00:00
Merge pull request #66 from ReDetection/fix-taps
Fix taps for borderless buttons
This commit is contained in:
commit
42ebb91e6b
@ -21,7 +21,6 @@ class CustomButtonTouchBarItem: NSCustomTouchBarItem, NSGestureRecognizerDelegat
|
|||||||
self.longTapClosure = callbackLong
|
self.longTapClosure = callbackLong
|
||||||
|
|
||||||
super.init(identifier: identifier)
|
super.init(identifier: identifier)
|
||||||
installButton(titled: title, bordered: true, backgroundColor: nil)
|
|
||||||
|
|
||||||
longClick = NSPressGestureRecognizer(target: self, action: #selector(handleGestureLong))
|
longClick = NSPressGestureRecognizer(target: self, action: #selector(handleGestureLong))
|
||||||
longClick.allowedTouchTypes = .direct
|
longClick.allowedTouchTypes = .direct
|
||||||
@ -31,8 +30,7 @@ class CustomButtonTouchBarItem: NSCustomTouchBarItem, NSGestureRecognizerDelegat
|
|||||||
singleClick.allowedTouchTypes = .direct
|
singleClick.allowedTouchTypes = .direct
|
||||||
singleClick.delegate = self
|
singleClick.delegate = self
|
||||||
|
|
||||||
self.view.addGestureRecognizer(longClick)
|
installButton(titled: title, bordered: true, backgroundColor: nil)
|
||||||
self.view.addGestureRecognizer(singleClick)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
required init?(coder: NSCoder) {
|
||||||
@ -65,6 +63,9 @@ class CustomButtonTouchBarItem: NSCustomTouchBarItem, NSGestureRecognizerDelegat
|
|||||||
}
|
}
|
||||||
button.title = title
|
button.title = title
|
||||||
self.view = button
|
self.view = button
|
||||||
|
|
||||||
|
self.view.addGestureRecognizer(longClick)
|
||||||
|
self.view.addGestureRecognizer(singleClick)
|
||||||
}
|
}
|
||||||
|
|
||||||
func gestureRecognizer(_ gestureRecognizer: NSGestureRecognizer, shouldRequireFailureOf otherGestureRecognizer: NSGestureRecognizer) -> Bool {
|
func gestureRecognizer(_ gestureRecognizer: NSGestureRecognizer, shouldRequireFailureOf otherGestureRecognizer: NSGestureRecognizer) -> Bool {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user