Adds force cursor support (flutter/engine#6945)
* engine force cursor support
This commit is contained in:
@@ -373,6 +373,25 @@
|
||||
arguments:@[ @(client), state ]];
|
||||
}
|
||||
|
||||
- (void)updateFloatingCursor:(FlutterFloatingCursorDragState)state
|
||||
withClient:(int)client
|
||||
withPosition:(NSDictionary*)position {
|
||||
NSString* stateString;
|
||||
switch (state) {
|
||||
case FlutterFloatingCursorDragStateStart:
|
||||
stateString = @"FloatingCursorDragState.start";
|
||||
break;
|
||||
case FlutterFloatingCursorDragStateUpdate:
|
||||
stateString = @"FloatingCursorDragState.update";
|
||||
break;
|
||||
case FlutterFloatingCursorDragStateEnd:
|
||||
stateString = @"FloatingCursorDragState.end";
|
||||
break;
|
||||
}
|
||||
[_textInputChannel.get() invokeMethod:@"TextInputClient.updateFloatingCursor"
|
||||
arguments:@[ @(client), stateString, position ]];
|
||||
}
|
||||
|
||||
- (void)performAction:(FlutterTextInputAction)action withClient:(int)client {
|
||||
NSString* actionString;
|
||||
switch (action) {
|
||||
|
||||
@@ -21,10 +21,19 @@ typedef NS_ENUM(NSInteger, FlutterTextInputAction) {
|
||||
FlutterTextInputActionNewline,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, FlutterFloatingCursorDragState) {
|
||||
FlutterFloatingCursorDragStateStart,
|
||||
FlutterFloatingCursorDragStateUpdate,
|
||||
FlutterFloatingCursorDragStateEnd,
|
||||
};
|
||||
|
||||
@protocol FlutterTextInputDelegate <NSObject>
|
||||
|
||||
- (void)updateEditingClient:(int)client withState:(NSDictionary*)state;
|
||||
- (void)performAction:(FlutterTextInputAction)action withClient:(int)client;
|
||||
- (void)updateFloatingCursor:(FlutterFloatingCursorDragState)state
|
||||
withClient:(int)client
|
||||
withPosition:(NSDictionary*)point;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -566,6 +566,24 @@ static UIReturnKeyType ToUIReturnKeyType(NSString* inputType) {
|
||||
return [FlutterTextRange rangeWithNSRange:[self rangeForCharacterAtIndex:currentIndex]];
|
||||
}
|
||||
|
||||
- (void)beginFloatingCursorAtPoint:(CGPoint)point {
|
||||
[_textInputDelegate updateFloatingCursor:FlutterFloatingCursorDragStateStart
|
||||
withClient:_textInputClient
|
||||
withPosition:@{@"X" : @(point.x), @"Y" : @(point.y)}];
|
||||
}
|
||||
|
||||
- (void)updateFloatingCursorAtPoint:(CGPoint)point {
|
||||
[_textInputDelegate updateFloatingCursor:FlutterFloatingCursorDragStateUpdate
|
||||
withClient:_textInputClient
|
||||
withPosition:@{@"X" : @(point.x), @"Y" : @(point.y)}];
|
||||
}
|
||||
|
||||
- (void)endFloatingCursor {
|
||||
[_textInputDelegate updateFloatingCursor:FlutterFloatingCursorDragStateEnd
|
||||
withClient:_textInputClient
|
||||
withPosition:@{@"X" : @(0), @"Y" : @(0)}];
|
||||
}
|
||||
|
||||
#pragma mark - UIKeyInput Overrides
|
||||
|
||||
- (void)updateEditingState {
|
||||
|
||||
Reference in New Issue
Block a user