iterate all customTapGestureRecognizer in OnScreenControls implementation to resolve conflict between tap gesture & osc touch
This commit is contained in:
1 parent
9618b7bb94
commit
f0e812e9e2
8 files changed
+50
-21
No files matched your search
@@ -31,6 +31,7 @@
|
||||
_view.multipleTouchEnabled = false;
|
||||
|
||||
self = [super initWithView:view controllerSup:controllerSupport streamConfig:streamConfig];
|
||||
self.isLayingOut = true; // make sure the super class have a flag to tell it's currently laying out the OSCs, intead play mode.
|
||||
self._level = oscLevel;
|
||||
|
||||
layoutChanges = [[NSMutableArray alloc] init]; // will contain OSC button layout changes the user has made for this profile
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
@property (nonatomic, assign) uint8_t numberOfTouchesRequired;
|
||||
@property (nonatomic, assign) bool immediateTriggering; // if enabled, trigger the signal on touchesBegan stage.
|
||||
@property (nonatomic, assign) double tapDownTimeThreshold; // tap down threshold in seconds.
|
||||
@property (nonatomic, assign) bool areVirtualControllerTaps; // will be set by the onscreencontrol class
|
||||
@property (nonatomic, assign) bool areOnScreenButtonTaps; // will be set by the onscreencontrol or other related class
|
||||
//@property (nonatomic, assign) bool haveOnScreenButtonsOnStreamview;
|
||||
@property (nonatomic, readonly) CGFloat lowestTouchPointHeight;
|
||||
@property (nonatomic, readonly) bool gestureCaptured;
|
||||
@property (nonatomic, readonly) NSTimeInterval gestureCapturedTime;
|
||||
|
||||
@@ -32,7 +32,7 @@ static CGFloat screenWidthInPoints;
|
||||
_immediateTriggering = false;
|
||||
_tapDownTimeThreshold = 0.3;
|
||||
_gestureCaptured = false;
|
||||
_areVirtualControllerTaps = false;
|
||||
_areOnScreenButtonTaps = false;
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -73,14 +73,14 @@ static CGFloat screenWidthInPoints;
|
||||
_gestureCaptured = false;
|
||||
self.state = UIGestureRecognizerStateFailed;
|
||||
}
|
||||
else if(_gestureCaptured && allTouchesCount == [touches count] && !_areVirtualControllerTaps){ //must exclude virtual controller taps here to prevent stucked button, _areVirtualControllerTaps flag is set by onscreencontrols or anyother related classes.
|
||||
else if(_gestureCaptured && allTouchesCount == [touches count] && !_areOnScreenButtonTaps){ //must exclude virtual controller taps here to prevent stucked button, _areVirtualControllerTaps flag is set by onscreencontrols or anyother related classes.
|
||||
_gestureCaptured = false; //reset for next recognition
|
||||
if((CACurrentMediaTime() - _gestureCapturedTime) < _tapDownTimeThreshold){
|
||||
lowestTouchPointYCoord = 0.0; //reset for next recognition
|
||||
self.state = UIGestureRecognizerStateRecognized;
|
||||
}
|
||||
}
|
||||
if (allTouchesCount == [touches count]) _areVirtualControllerTaps = false; // need to reset this flag anyway, when all fingers are lefting
|
||||
if (allTouchesCount == [touches count]) _areOnScreenButtonTaps = false; // need to reset this flag anyway, when all fingers are lefting
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -33,7 +33,8 @@ typedef NS_ENUM(NSInteger, OnScreenControlsLevel) {
|
||||
};
|
||||
|
||||
|
||||
@property (nonatomic, assign) CustomTapGestureRecognizer* mouseRightClickTapRecognizer; // this object will be passed to onscreencontrols class for areVirtualControllerTaps flag setting
|
||||
// @property (nonatomic, assign) CustomTapGestureRecognizer* mouseRightClickTapRecognizer; // this object will be passed to onscreencontrols class for areVirtualControllerTaps flag setting
|
||||
@property (nonatomic, assign) bool isLayingOut;
|
||||
@property CALayer* _aButton;
|
||||
@property CALayer* _bButton;
|
||||
@property CALayer* _xButton;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#import "OnScreenControls.h"
|
||||
#import "StreamView.h"
|
||||
#import "CustomTapGestureRecognizer.h"
|
||||
#import "Controller.h"
|
||||
#include "Limelight.h"
|
||||
#import "OnScreenButtonState.h"
|
||||
@@ -128,6 +129,7 @@ static float L3_Y;
|
||||
|
||||
- (id) initWithView:(UIView*)view controllerSup:(ControllerSupport*)controllerSupport streamConfig:(StreamConfiguration*)streamConfig {
|
||||
self = [self init];
|
||||
self.isLayingOut = false; // set false by default (play mode instead of layout mode)
|
||||
_view = view;
|
||||
|
||||
profilesManager = [OSCProfilesManager sharedManager];
|
||||
@@ -1037,11 +1039,23 @@ static float L3_Y;
|
||||
}
|
||||
}
|
||||
if (updated) {
|
||||
_mouseRightClickTapRecognizer.areVirtualControllerTaps = true; //inform the tap recognizer that this will be a controller tap.
|
||||
|
||||
[_controllerSupport updateFinished:_controller];
|
||||
}
|
||||
return updated || stickTouch;
|
||||
|
||||
bool oscTouched = updated || stickTouch;
|
||||
if(oscTouched){
|
||||
StreamView *streamView = (StreamView* )self->_view;
|
||||
for (UIGestureRecognizer *gesture in _view.gestureRecognizers) {
|
||||
if ([gesture isKindOfClass:[CustomTapGestureRecognizer class]]) {
|
||||
// This is a CustomTapGestureRecognizer
|
||||
CustomTapGestureRecognizer *tapGesture = (CustomTapGestureRecognizer *)gesture;
|
||||
tapGesture.areOnScreenButtonTaps = true;
|
||||
// Perform actions with tapGesture
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return oscTouched;
|
||||
}
|
||||
|
||||
- (BOOL)handleTouchUpEvent:touches {
|
||||
|
||||
@@ -124,11 +124,12 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
||||
}
|
||||
|
||||
onScreenControls = [[OnScreenControls alloc] initWithView:self controllerSup:controllerSupport streamConfig:streamConfig];
|
||||
/*
|
||||
// here we pass the tap recognizer to the onscreencontrols obj
|
||||
if (settings.touchMode.intValue == RELATIVE_TOUCH){
|
||||
RelativeTouchHandler* relativeTouchHandler = (RelativeTouchHandler*) touchHandler;
|
||||
onScreenControls.mouseRightClickTapRecognizer = relativeTouchHandler.mouseRightClickTapRecognizer;
|
||||
}
|
||||
} */
|
||||
|
||||
OnScreenControlsLevel level = (OnScreenControlsLevel)[settings.onscreenControls integerValue];
|
||||
if (settings.touchMode.intValue != RELATIVE_TOUCH && settings.touchMode.intValue != REGULAR_NATIVE_TOUCH ) {
|
||||
@@ -301,11 +302,14 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (bool) isOscEnabled{
|
||||
return (settings.touchMode.intValue == RELATIVE_TOUCH || settings.touchMode.intValue == REGULAR_NATIVE_TOUCH) && settings.onscreenControls.intValue != OnScreenControlsLevelOff;
|
||||
}
|
||||
|
||||
- (void) reloadOnScreenControlsRealtimeWith:(ControllerSupport*)controllerSupport
|
||||
andConfig:(StreamConfiguration*)streamConfig {
|
||||
[self reloadOnScreenControlsWith:controllerSupport andConfig:streamConfig];
|
||||
bool oscEnabled = (settings.touchMode.intValue == RELATIVE_TOUCH || settings.touchMode.intValue == REGULAR_NATIVE_TOUCH) && settings.onscreenControls.intValue != OnScreenControlsLevelOff;
|
||||
if(oscEnabled) [self showOnScreenControls];
|
||||
if([self isOscEnabled]) [self showOnScreenControls];
|
||||
else [self disableOnScreenControls];
|
||||
}
|
||||
|
||||
@@ -313,6 +317,14 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
||||
- (void) reloadOnScreenControlsWith:(ControllerSupport*)controllerSupport
|
||||
andConfig:(StreamConfiguration*)streamConfig {
|
||||
onScreenControls = [[OnScreenControls alloc] initWithView:self controllerSup:controllerSupport streamConfig:streamConfig];
|
||||
|
||||
/*
|
||||
// pass mouseRightClickTapRecognizer to onScreenControls obj here:
|
||||
if([self isOscEnabled]){
|
||||
|
||||
RelativeTouchHandler* relativeTouchHandler = (RelativeTouchHandler *)touchHandler;
|
||||
onScreenControls.mouseRightClickTapRecognizer = relativeTouchHandler.mouseRightClickTapRecognizer;
|
||||
} */
|
||||
[onScreenControls setLevel:(OnScreenControlsLevel)settings.onscreenControls.intValue];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user