X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=NJOutputMouseButton.m;h=d5b1f16e940baade744c9dddcaed2699decf49a3;hp=0cc403f9e533932050d2ea019b3588068f451f7d;hb=b8c30e0c06effb8f4a937378e5c4cf8a22f40c59;hpb=dcedf147ddcb6c21768cea94a2f06b93007d2a82 diff --git a/NJOutputMouseButton.m b/NJOutputMouseButton.m index 0cc403f..d5b1f16 100644 --- a/NJOutputMouseButton.m +++ b/NJOutputMouseButton.m @@ -14,17 +14,17 @@ } - (NSDictionary *)serialize { - return @{ @"type": @"mouse button", @"button": @(_button) }; + return @{ @"type": self.class.serializationCode, @"button": @(_button) }; } + (NJOutput *)outputDeserialize:(NSDictionary *)serialization withMappings:(NSArray *)mappings { - NJOutputMouseButton *output = [[NJOutputMouseButton alloc] init]; + NJOutputMouseButton *output = [[NJOutputMouseButton alloc] init]; output.button = [serialization[@"button"] intValue]; - return output; + return output; } --(void) trigger { +- (void)trigger { CGFloat height = NSScreen.mainScreen.frame.size.height; NSPoint mouseLoc = NSEvent.mouseLocation; CGEventType eventType = (_button == kCGMouseButtonLeft) ? kCGEventLeftMouseDown : kCGEventRightMouseDown; @@ -36,7 +36,7 @@ CFRelease(click); } --(void) untrigger { +- (void)untrigger { CGFloat height = NSScreen.mainScreen.frame.size.height; NSPoint mouseLoc = NSEvent.mouseLocation; CGEventType eventType = (_button == kCGMouseButtonLeft) ? kCGEventLeftMouseUp : kCGEventRightMouseUp;