Last active
October 9, 2017 21:14
-
-
Save Palisand/7d4f2e23966faf274320c7b16e91e463 to your computer and use it in GitHub Desktop.
Changes for scroll-to-cursor functionality.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation RCTTextSelection | |
/* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */ | |
- (instancetype)initWithStart:(NSInteger)start end:(NSInteger)end cursorPosition:(CGPoint)cursorPosition | |
/* <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< */ | |
{ | |
if (self = [super init]) { | |
_start = start; | |
_end = end; | |
/* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */ | |
_cursorPosition = cursorPosition; | |
/* <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< */ | |
} | |
return self; | |
} | |
@end | |
@implementation RCTConvert (RCTTextSelection) | |
+ (RCTTextSelection *)RCTTextSelection:(id)json | |
{ | |
if ([json isKindOfClass:[NSDictionary class]]) { | |
NSInteger start = [self NSInteger:json[@"start"]]; | |
NSInteger end = [self NSInteger:json[@"end"]]; | |
/* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */ | |
CGPoint cursorPosition = CGPointMake( | |
[self CGFloat:json[@"cursorPositionX"]], | |
[self CGFloat:json[@"cursorPositionY"]] | |
); | |
return [[RCTTextSelection alloc] initWithStart:start | |
end:end | |
cursorPosition:cursorPosition]; | |
/* <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< */ | |
} | |
return nil; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment