diff --git a/src/app/core/platform/view_controller.h b/src/app/core/platform/view_controller.h index 7b006f00..7c4318a3 100644 --- a/src/app/core/platform/view_controller.h +++ b/src/app/core/platform/view_controller.h @@ -14,6 +14,7 @@ @property(nonatomic) UIHoverGestureRecognizer *hoverGestureRecognizer; @property(nonatomic) UIPinchGestureRecognizer *pinchRecognizer; @property(nonatomic) UISwipeGestureRecognizer *swipeRecognizer; +@property(nonatomic) UILongPressGestureRecognizer *longPressRecognizer; @end #endif diff --git a/src/ios/main.mm b/src/ios/main.mm index 478c7be0..bece9487 100644 --- a/src/ios/main.mm +++ b/src/ios/main.mm @@ -102,10 +102,12 @@ _pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinch:)]; [self.view addGestureRecognizer:_pinchRecognizer]; + _longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)]; + [self.view addGestureRecognizer:_longPressRecognizer]; + _swipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)]; _swipeRecognizer.direction = UISwipeGestureRecognizerDirectionRight | UISwipeGestureRecognizerDirectionLeft; [self.view addGestureRecognizer:_swipeRecognizer]; - return self; } @@ -249,6 +251,12 @@ } } +- (void)handleLongPress:(UILongPressGestureRecognizer *)gesture { + ImGuiIO &io = ImGui::GetIO(); + io.AddMouseSourceEvent(ImGuiMouseSource_TouchScreen); + io.AddMouseButtonEvent(1, gesture.state == UIGestureRecognizerStateBegan); +} + #endif @end