Skip to content
This repository was archived by the owner on Jul 16, 2024. It is now read-only.
Open
Changes from all commits
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
7 changes: 6 additions & 1 deletion SYFlatButton/SYFlatButton/SYFlatButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,12 @@ - (void)mouseUp:(NSEvent *)event {
if (self.momentary) {
self.state = (self.state == NSOnState) ? NSOffState : NSOnState;
}
[NSApp sendAction:self.action to:self.target from:self];
NSPoint eventLocation = [event locationInWindow];
NSPoint point = [self convertPoint:eventLocation fromView:nil];
if (NSPointInRect(point, self.bounds)) {
//松开位置在按钮范围内
[NSApp sendAction:self.action to:self.target from:self];
}
}
}

Expand Down