// // KMBox.m // SignFlow // // Created by wanjun on 2020/10/21. // #import "KMOCRBox.h" @implementation KMOCRBox - (void)viewDidMoveToWindow { [super viewDidMoveToWindow]; if ([self window] != nil) { [self addTrackingRect:[self bounds] owner:self userData:NULL assumeInside:NO]; } } - (void)setFrameSize:(NSSize)newSize { [super setFrameSize:newSize]; [self addTrackingRect:NSMakeRect(0, 0, newSize.width, newSize.height) owner:self userData:NULL assumeInside:NO]; } - (void)mouseEntered:(NSEvent *)event { if (self.mouseMoveCallback) { self.mouseMoveCallback(YES, self); } } - (void)mouseExited:(NSEvent *)event { if (self.mouseMoveCallback) { self.mouseMoveCallback(NO, self); } } - (void)mouseDown:(NSEvent *)event { [super mouseDown:event]; if (self.mouseDownCallback) { self.mouseDownCallback(YES, self); } } - (void)mouseUp:(NSEvent *)event { [super mouseUp:event]; if (self.mouseDownCallback) { self.mouseDownCallback(NO, self); } } @end