|
56 | 56 | // This is left a FlutterBinaryMessenger privately for now to give people a chance to notice the |
57 | 57 | // change. Unfortunately unless you have Werror turned on, incompatible pointers as arguments are |
58 | 58 | // just a warning. |
59 | | -@interface FlutterViewController () <FlutterBinaryMessenger, |
60 | | - UIScrollViewDelegate, |
61 | | - UIPencilInteractionDelegate> |
| 59 | +@interface FlutterViewController () <FlutterBinaryMessenger, UIScrollViewDelegate> |
62 | 60 | @property(nonatomic, readwrite, getter=isDisplayingFlutterUI) BOOL displayingFlutterUI; |
63 | 61 | @property(nonatomic, assign) BOOL isHomeIndicatorHidden; |
64 | 62 | @property(nonatomic, assign) BOOL isPresentingViewControllerAnimating; |
@@ -99,7 +97,7 @@ @interface FlutterViewController () <FlutterBinaryMessenger, |
99 | 97 | // Trackpad rotating |
100 | 98 | @property(nonatomic, retain) |
101 | 99 | UIRotationGestureRecognizer* rotationGestureRecognizer API_AVAILABLE(ios(13.4)); |
102 | | -@property(nonatomic, retain) UIPencilInteraction* pencilInteraction API_AVAILABLE(ios(13.4)); |
| 100 | + |
103 | 101 | /** |
104 | 102 | * Creates and registers plugins used by this view controller. |
105 | 103 | */ |
@@ -724,10 +722,6 @@ - (void)viewDidLoad { |
724 | 722 | [self createTouchRateCorrectionVSyncClientIfNeeded]; |
725 | 723 |
|
726 | 724 | if (@available(iOS 13.4, *)) { |
727 | | - _pencilInteraction = [[UIPencilInteraction alloc] init]; |
728 | | - _pencilInteraction.delegate = self; |
729 | | - [_flutterView addInteraction:_pencilInteraction]; |
730 | | - |
731 | 725 | _hoverGestureRecognizer = |
732 | 726 | [[UIHoverGestureRecognizer alloc] initWithTarget:self action:@selector(hoverEvent:)]; |
733 | 727 | _hoverGestureRecognizer.delegate = self; |
@@ -901,8 +895,6 @@ - (void)dealloc { |
901 | 895 | [_pinchGestureRecognizer release]; |
902 | 896 | _rotationGestureRecognizer.delegate = nil; |
903 | 897 | [_rotationGestureRecognizer release]; |
904 | | - _pencilInteraction.delegate = nil; |
905 | | - [_pencilInteraction release]; |
906 | 898 | [super dealloc]; |
907 | 899 | } |
908 | 900 |
|
@@ -977,7 +969,7 @@ - (void)goToApplicationLifecycle:(nonnull NSString*)state { |
977 | 969 | case UITouchTypeDirect: |
978 | 970 | case UITouchTypeIndirect: |
979 | 971 | return flutter::PointerData::DeviceKind::kTouch; |
980 | | - case UITouchTypePencil: |
| 972 | + case UITouchTypeStylus: |
981 | 973 | return flutter::PointerData::DeviceKind::kStylus; |
982 | 974 | case UITouchTypeIndirectPointer: |
983 | 975 | return flutter::PointerData::DeviceKind::kMouse; |
@@ -1232,50 +1224,6 @@ - (void)invalidateTouchRateCorrectionVSyncClient { |
1232 | 1224 | _touchRateCorrectionVSyncClient = nil; |
1233 | 1225 | } |
1234 | 1226 |
|
1235 | | -#pragma mark - Stylus Events |
1236 | | - |
1237 | | -- (void)pencilInteractionDidTap:(UIPencilInteraction*)interaction API_AVAILABLE(ios(13.4)) { |
1238 | | - flutter::PointerData pointer_data = [self createAuxillaryStylusActionData]; |
1239 | | - |
1240 | | - auto packet = std::make_unique<flutter::PointerDataPacket>(1); |
1241 | | - packet->SetPointerData(/*index=*/0, pointer_data); |
1242 | | - [_engine.get() dispatchPointerDataPacket:std::move(packet)]; |
1243 | | -} |
1244 | | - |
1245 | | -- (flutter::PointerData)createAuxillaryStylusActionData API_AVAILABLE(ios(13.4)) { |
1246 | | - flutter::PointerData pointer_data; |
1247 | | - pointer_data.Clear(); |
1248 | | - |
1249 | | - switch (UIPencilInteraction.preferredTapAction) { |
1250 | | - case UIPencilPreferredActionIgnore: |
1251 | | - pointer_data.preferred_auxiliary_stylus_action = |
1252 | | - flutter::PointerData::PreferredStylusAuxiliaryAction::kIgnore; |
1253 | | - break; |
1254 | | - case UIPencilPreferredActionShowColorPalette: |
1255 | | - pointer_data.preferred_auxiliary_stylus_action = |
1256 | | - flutter::PointerData::PreferredStylusAuxiliaryAction::kShowColorPalette; |
1257 | | - break; |
1258 | | - case UIPencilPreferredActionSwitchEraser: |
1259 | | - pointer_data.preferred_auxiliary_stylus_action = |
1260 | | - flutter::PointerData::PreferredStylusAuxiliaryAction::kSwitchEraser; |
1261 | | - break; |
1262 | | - case UIPencilPreferredActionSwitchPrevious: |
1263 | | - pointer_data.preferred_auxiliary_stylus_action = |
1264 | | - flutter::PointerData::PreferredStylusAuxiliaryAction::kSwitchPrevious; |
1265 | | - break; |
1266 | | - default: |
1267 | | - pointer_data.preferred_auxiliary_stylus_action = |
1268 | | - flutter::PointerData::PreferredStylusAuxiliaryAction::kUnknown; |
1269 | | - break; |
1270 | | - } |
1271 | | - |
1272 | | - pointer_data.time_stamp = [[NSProcessInfo processInfo] systemUptime] * kMicrosecondsPerSecond; |
1273 | | - pointer_data.kind = flutter::PointerData::DeviceKind::kStylus; |
1274 | | - pointer_data.signal_kind = flutter::PointerData::SignalKind::kStylusAuxiliaryAction; |
1275 | | - |
1276 | | - return pointer_data; |
1277 | | -} |
1278 | | - |
1279 | 1227 | #pragma mark - Handle view resizing |
1280 | 1228 |
|
1281 | 1229 | - (void)updateViewportMetrics { |
|
0 commit comments