add long press right click to iOS

This commit is contained in:
scawful
2024-08-11 01:17:59 -04:00
parent cc39225a2a
commit a82a3f3c9e
2 changed files with 10 additions and 1 deletions

View File

@@ -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