X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=TargetMouseScroll.m;h=d840ba1069bfe2539a50cbd44d79e8d7bda40dd2;hp=3c417c1264a56576d0d4d2870af97d219acfdbb3;hb=681ca0346ecb3f3da2c45a1a470601f15aad22cf;hpb=0a402879ee3beb79bb4d2270f909ad75eead0c96 diff --git a/TargetMouseScroll.m b/TargetMouseScroll.m index 3c417c1..d840ba1 100644 --- a/TargetMouseScroll.m +++ b/TargetMouseScroll.m @@ -3,34 +3,31 @@ // Enjoy // // Created by Yifeng Huang on 7/28/12. -// Copyright (c) 2012 __MyCompanyName__. All rights reserved. // #import "TargetMouseScroll.h" @implementation TargetMouseScroll -@synthesize howMuch; - + (NSString *)serializationCode { return @"mscroll"; } - (NSDictionary *)serialize { - return @{ @"type": @"mscroll", @"howMuch": @(self.howMuch) }; + return @{ @"type": @"mscroll", @"amount": @(_amount) }; } + (Target *)targetDeserialize:(NSDictionary *)serialization withConfigs:(NSArray *)configs { TargetMouseScroll *target = [[TargetMouseScroll alloc] init]; - target.howMuch = [serialization[@"howMuch"] intValue]; + target.amount = [serialization[@"amount"] intValue]; return target; } -(void) trigger { CGEventRef scroll = CGEventCreateScrollWheelEvent(NULL, kCGScrollEventUnitLine, 1, - self.howMuch); + _amount); CGEventPost(kCGHIDEventTap, scroll); CFRelease(scroll); }