Clean up some comments.
[enjoyable.git] / TargetMouseScroll.m
1 //
2 // TargetMouseScroll.m
3 // Enjoy
4 //
5 // Created by Yifeng Huang on 7/28/12.
6 //
7
8 #import "TargetMouseScroll.h"
9
10 @implementation TargetMouseScroll
11
12 + (NSString *)serializationCode {
13 return @"mscroll";
14 }
15
16 - (NSDictionary *)serialize {
17 return @{ @"type": @"mscroll", @"amount": @(_amount) };
18 }
19
20 + (Target *)targetDeserialize:(NSDictionary *)serialization
21 withConfigs:(NSArray *)configs {
22 TargetMouseScroll *target = [[TargetMouseScroll alloc] init];
23 target.amount = [serialization[@"amount"] intValue];
24 return target;
25 }
26 -(void) trigger {
27 CGEventRef scroll = CGEventCreateScrollWheelEvent(NULL,
28 kCGScrollEventUnitLine,
29 1,
30 _amount);
31 CGEventPost(kCGHIDEventTap, scroll);
32 CFRelease(scroll);
33 }
34
35 @end