Bug fix: buggy mouse on grab mode
TODO: fix mouse on UI, where it click before receive mouse position
This commit is contained in:
1 parent
77356a3474
commit
895d97a639
1 file changed
+16
-10
@@ -45,6 +45,7 @@
|
||||
|
||||
int togglableVisibleButtonIndex = -1;
|
||||
UIButton* togglableVisibleButtons[100];
|
||||
UIView *touchView;
|
||||
UITextField *inputView;
|
||||
|
||||
// TODO: key modifiers impl
|
||||
@@ -70,6 +71,17 @@ UITextField *inputView;
|
||||
int width = (int) roundf(screenBounds.size.width);
|
||||
int height = (int) roundf(screenBounds.size.height);
|
||||
|
||||
touchView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width, height)];
|
||||
|
||||
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(surfaceOnClick:)];
|
||||
tapGesture.numberOfTapsRequired = 1;
|
||||
[touchView addGestureRecognizer:tapGesture];
|
||||
|
||||
UILongPressGestureRecognizer *longpressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(surfaceOnLongpress:)];
|
||||
[touchView addGestureRecognizer:longpressGesture];
|
||||
|
||||
[self.view addSubview:touchView];
|
||||
|
||||
inputView = [[UITextField alloc] initWithFrame:CGRectMake(5 * 3 + 80 * 2, 5, BTN_RECT)];
|
||||
|
||||
inputView.backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.0f];
|
||||
@@ -114,13 +126,6 @@ UITextField *inputView;
|
||||
MGLKView *view = glView = (MGLKView *) self.view;
|
||||
view.drawableDepthFormat = MGLDrawableDepthFormat24;
|
||||
view.enableSetNeedsDisplay = YES;
|
||||
|
||||
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(surfaceOnClick:)];
|
||||
tapGesture.numberOfTapsRequired = 1;
|
||||
[view addGestureRecognizer:tapGesture];
|
||||
|
||||
UILongPressGestureRecognizer *longpressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(surfaceOnLongpress:)];
|
||||
[view addGestureRecognizer:longpressGesture];
|
||||
|
||||
// Init GLES
|
||||
self.context = [[MGLContext alloc] initWithAPI:kMGLRenderingAPIOpenGLES3];
|
||||
@@ -293,9 +298,10 @@ BOOL isNotifRemoved;
|
||||
- (void)sendTouchEvent:(NSSet *)touches withEvent:(int)event
|
||||
{
|
||||
UITouch* touchEvent = [touches anyObject];
|
||||
CGPoint locationInView = [touchEvent locationInView:self.view];
|
||||
|
||||
[self sendTouchPoint:locationInView withEvent:event];
|
||||
if ([touchEvent view] == touchView) {
|
||||
CGPoint locationInView = [touchEvent locationInView:touchView];
|
||||
[self sendTouchPoint:locationInView withEvent:event];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)sendTouchPoint:(CGPoint)location withEvent:(int)event{
|
||||
|
||||
Reference in new issue
Block a user