add long press right click to iOS
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user