X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=TargetMouseScroll.m;h=6986004b4b7bac8c6f4e43c4cb2bca48a1f56452;hp=3c417c1264a56576d0d4d2870af97d219acfdbb3;hb=794561a4606fa9e31e3b2b077891f5b1e6084698;hpb=0a402879ee3beb79bb4d2270f909ad75eead0c96 diff --git a/TargetMouseScroll.m b/TargetMouseScroll.m index 3c417c1..6986004 100644 --- a/TargetMouseScroll.m +++ b/TargetMouseScroll.m @@ -10,27 +10,25 @@ @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); }