minior change
This commit is contained in:
1 parent
3442df0ca4
commit
bfe02ed6a3
1 file changed
+7
-5
@@ -19,6 +19,7 @@
|
|||||||
@implementation NativeTouchHandler {
|
@implementation NativeTouchHandler {
|
||||||
StreamView* streamView;
|
StreamView* streamView;
|
||||||
TemporarySettings* currentSettings;
|
TemporarySettings* currentSettings;
|
||||||
|
BOOL activateCoordSelector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@
|
|||||||
self = [self init];
|
self = [self init];
|
||||||
self->streamView = view;
|
self->streamView = view;
|
||||||
self->currentSettings = settings;
|
self->currentSettings = settings;
|
||||||
|
self->activateCoordSelector = currentSettings.pointerVelocityModeDivider.floatValue != 1.0;
|
||||||
[NativeTouchPointer setPointerVelocityDivider:settings.pointerVelocityModeDivider.floatValue];
|
[NativeTouchPointer setPointerVelocityDivider:settings.pointerVelocityModeDivider.floatValue];
|
||||||
[NativeTouchPointer setPointerVelocityFactor:settings.touchPointerVelocityFactor.floatValue];
|
[NativeTouchPointer setPointerVelocityFactor:settings.touchPointerVelocityFactor.floatValue];
|
||||||
[NativeTouchPointer initContextWith:streamView];
|
[NativeTouchPointer initContextWith:streamView];
|
||||||
@@ -48,7 +50,7 @@
|
|||||||
|
|
||||||
- (void)sendTouchEvent:(UITouch*)event touchType:(uint8_t)touchType{
|
- (void)sendTouchEvent:(UITouch*)event touchType:(uint8_t)touchType{
|
||||||
CGPoint targetCoords;
|
CGPoint targetCoords;
|
||||||
if(currentSettings.pointerVelocityModeDivider.floatValue != 1.0 && event.phase == UITouchPhaseMoved) targetCoords = [NativeTouchPointer selectCoordsFor:event]; // coordinates of touch pointer replaced to relative ones here.
|
if(activateCoordSelector && event.phase == UITouchPhaseMoved) targetCoords = [NativeTouchPointer selectCoordsFor:event]; // coordinates of touch pointer replaced to relative ones here.
|
||||||
else targetCoords = [event locationInView:streamView];
|
else targetCoords = [event locationInView:streamView];
|
||||||
CGPoint location = [streamView adjustCoordinatesForVideoArea:targetCoords];
|
CGPoint location = [streamView adjustCoordinatesForVideoArea:targetCoords];
|
||||||
CGSize videoSize = [streamView getVideoAreaSize];
|
CGSize videoSize = [streamView getVideoAreaSize];
|
||||||
@@ -82,24 +84,24 @@
|
|||||||
case UITouchPhaseBegan://touchBegan
|
case UITouchPhaseBegan://touchBegan
|
||||||
type = LI_TOUCH_EVENT_DOWN;
|
type = LI_TOUCH_EVENT_DOWN;
|
||||||
[NativeTouchPointer populatePointerId:event]; //generate & populate pointerId
|
[NativeTouchPointer populatePointerId:event]; //generate & populate pointerId
|
||||||
if(currentSettings.pointerVelocityModeDivider.floatValue != 1.0) [NativeTouchPointer populatePointerObjIntoDict:event];
|
if(activateCoordSelector) [NativeTouchPointer populatePointerObjIntoDict:event];
|
||||||
break;
|
break;
|
||||||
case UITouchPhaseMoved://touchMoved
|
case UITouchPhaseMoved://touchMoved
|
||||||
case UITouchPhaseStationary:
|
case UITouchPhaseStationary:
|
||||||
type = LI_TOUCH_EVENT_MOVE;
|
type = LI_TOUCH_EVENT_MOVE;
|
||||||
if(currentSettings.pointerVelocityModeDivider.floatValue != 1.0) [NativeTouchPointer updatePointerObjInDict:event];
|
if(activateCoordSelector) [NativeTouchPointer updatePointerObjInDict:event];
|
||||||
break;
|
break;
|
||||||
case UITouchPhaseEnded://touchEnded
|
case UITouchPhaseEnded://touchEnded
|
||||||
type = LI_TOUCH_EVENT_UP;
|
type = LI_TOUCH_EVENT_UP;
|
||||||
[self sendTouchEvent:event touchType:type]; //send touch event first
|
[self sendTouchEvent:event touchType:type]; //send touch event first
|
||||||
[NativeTouchPointer removePointerId:event]; //then remove pointerId
|
[NativeTouchPointer removePointerId:event]; //then remove pointerId
|
||||||
if(currentSettings.pointerVelocityModeDivider.floatValue != 1.0) [NativeTouchPointer removePointerObjFromDict:event];
|
if(activateCoordSelector) [NativeTouchPointer removePointerObjFromDict:event];
|
||||||
return;
|
return;
|
||||||
case UITouchPhaseCancelled://touchCancelled
|
case UITouchPhaseCancelled://touchCancelled
|
||||||
type = LI_TOUCH_EVENT_CANCEL;
|
type = LI_TOUCH_EVENT_CANCEL;
|
||||||
[self sendTouchEvent:event touchType:type]; //send touch event first
|
[self sendTouchEvent:event touchType:type]; //send touch event first
|
||||||
[NativeTouchPointer removePointerId:event]; //then remove pointerId
|
[NativeTouchPointer removePointerId:event]; //then remove pointerId
|
||||||
if(currentSettings.pointerVelocityModeDivider.floatValue != 1.0) [NativeTouchPointer removePointerObjFromDict:event];
|
if(activateCoordSelector) [NativeTouchPointer removePointerObjFromDict:event];
|
||||||
return;
|
return;
|
||||||
case UITouchPhaseRegionEntered:
|
case UITouchPhaseRegionEntered:
|
||||||
case UITouchPhaseRegionMoved:
|
case UITouchPhaseRegionMoved:
|
||||||
|
|||||||
Reference in new issue
Block a user