add long press right click to iOS
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
@property(nonatomic) UIHoverGestureRecognizer *hoverGestureRecognizer;
|
@property(nonatomic) UIHoverGestureRecognizer *hoverGestureRecognizer;
|
||||||
@property(nonatomic) UIPinchGestureRecognizer *pinchRecognizer;
|
@property(nonatomic) UIPinchGestureRecognizer *pinchRecognizer;
|
||||||
@property(nonatomic) UISwipeGestureRecognizer *swipeRecognizer;
|
@property(nonatomic) UISwipeGestureRecognizer *swipeRecognizer;
|
||||||
|
@property(nonatomic) UILongPressGestureRecognizer *longPressRecognizer;
|
||||||
@end
|
@end
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -102,10 +102,12 @@
|
|||||||
_pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinch:)];
|
_pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinch:)];
|
||||||
[self.view addGestureRecognizer:_pinchRecognizer];
|
[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 = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)];
|
||||||
_swipeRecognizer.direction = UISwipeGestureRecognizerDirectionRight | UISwipeGestureRecognizerDirectionLeft;
|
_swipeRecognizer.direction = UISwipeGestureRecognizerDirectionRight | UISwipeGestureRecognizerDirectionLeft;
|
||||||
[self.view addGestureRecognizer:_swipeRecognizer];
|
[self.view addGestureRecognizer:_swipeRecognizer];
|
||||||
|
|
||||||
return self;
|
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
|
#endif
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
Reference in New Issue
Block a user