Skip to content
This repository has been archived by the owner on Feb 25, 2025. It is now read-only.

Commit

Permalink
iPhone floating cursor selection (#36643)
Browse files Browse the repository at this point in the history
Floating cursor selection hasn't worked as we haven't been returning a real value for `caretRectForPosition:`. If we have the selection rectangles, we can do so. 

Fixes [#30476](flutter/flutter#30476)

Requires selection rects to be turned on for iPhone (flutter/flutter#113048)

writing and running engine tests.
  • Loading branch information
moffatman authored May 11, 2023
1 parent 8a559ea commit b120180
Show file tree
Hide file tree
Showing 3 changed files with 431 additions and 140 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ typedef NS_ENUM(NSInteger, FlutterScribbleInteractionStatus) {
@interface FlutterTextPosition : UITextPosition

@property(nonatomic, readonly) NSUInteger index;
@property(nonatomic, readonly) UITextStorageDirection affinity;

+ (instancetype)positionWithIndex:(NSUInteger)index;
- (instancetype)initWithIndex:(NSUInteger)index;
+ (instancetype)positionWithIndex:(NSUInteger)index affinity:(UITextStorageDirection)affinity;
- (instancetype)initWithIndex:(NSUInteger)index affinity:(UITextStorageDirection)affinity;

@end

Expand Down Expand Up @@ -100,6 +102,10 @@ typedef NS_ENUM(NSInteger, FlutterScribbleInteractionStatus) {

+ (instancetype)selectionRectWithRect:(CGRect)rect position:(NSUInteger)position;

+ (instancetype)selectionRectWithRect:(CGRect)rect
position:(NSUInteger)position
writingDirection:(NSWritingDirection)writingDirection;

- (instancetype)initWithRectAndInfo:(CGRect)rect
position:(NSUInteger)position
writingDirection:(NSWritingDirection)writingDirection
Expand All @@ -108,6 +114,8 @@ typedef NS_ENUM(NSInteger, FlutterScribbleInteractionStatus) {
isVertical:(BOOL)isVertical;

- (instancetype)init NS_UNAVAILABLE;

- (BOOL)isRTL;
@end

API_AVAILABLE(ios(13.0)) @interface FlutterTextPlaceholder : UITextPlaceholder
Expand Down
Loading

0 comments on commit b120180

Please sign in to comment.