fix touch interruption on the left side of screen under high pointer velocity (sensitivity)
This commit is contained in:
1 parent
b05c3c7e4a
commit
ef5c77d8df
2 files changed
+10
-4
No files matched your search
@@ -89,7 +89,7 @@
|
|||||||
|
|
||||||
if([NativeTouchPointer getPointerObjFromDict:touch].boundaryReached){ // access whether the current pointer has reached the boundary.
|
if([NativeTouchPointer getPointerObjFromDict:touch].boundaryReached){ // access whether the current pointer has reached the boundary.
|
||||||
LiSendTouchEvent(LI_TOUCH_EVENT_UP, pointerId, normalizedX, normalizedY, 0, 0, 0, 0); //event must sent from the lowest level directy by LiSendTouchEvent to simulate continous dragging to another point on screen
|
LiSendTouchEvent(LI_TOUCH_EVENT_UP, pointerId, normalizedX, normalizedY, 0, 0, 0, 0); //event must sent from the lowest level directy by LiSendTouchEvent to simulate continous dragging to another point on screen
|
||||||
LiSendTouchEvent(LI_TOUCH_EVENT_DOWN, pointerId, 0.5, 0.4, 0, 0, 0, 0);
|
LiSendTouchEvent(LI_TOUCH_EVENT_DOWN, pointerId, 0.3, 0.4, 0, 0, 0, 0);
|
||||||
}else LiSendTouchEvent(touchType, pointerId, normalizedX, normalizedY,(touch.force / touch.maximumPossibleForce) / sin(touch.altitudeAngle),0.0f, 0.0f,[streamView getRotationFromAzimuthAngle:[touch azimuthAngleInView:streamView]]);
|
}else LiSendTouchEvent(touchType, pointerId, normalizedX, normalizedY,(touch.force / touch.maximumPossibleForce) / sin(touch.altitudeAngle),0.0f, 0.0f,[streamView getRotationFromAzimuthAngle:[touch azimuthAngleInView:streamView]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ StreamView *streamView;
|
|||||||
CGPoint previousPoint;
|
CGPoint previousPoint;
|
||||||
CGPoint latestRelativePoint;
|
CGPoint latestRelativePoint;
|
||||||
CGPoint previousRelativePoint;
|
CGPoint previousRelativePoint;
|
||||||
|
bool useRelativeCoords;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithTouch:(UITouch *)touch{
|
- (instancetype)initWithTouch:(UITouch *)touch{
|
||||||
@@ -41,7 +42,8 @@ StreamView *streamView;
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (bool)doesReachBoundary{
|
- (bool)doesReachBoundary{
|
||||||
_boundaryReached = (pointerVelocityFactor > 1.0f) && (latestRelativePoint.x > screenWidthInPoints || latestRelativePoint.x < 0.0f || latestRelativePoint.y > screenHeightInPoints || latestRelativePoint.y < 0.0f); // boundary detection & coordinates reset to the central screen point for HK:StarTrail(needs a very high pointer velocity); // boundary detection & coordinates reset to the specific point for HK:StarTrail(needs a very high pointer velocity)
|
_boundaryReached = (pointerVelocityFactor > 1.0f) && self->useRelativeCoords && (latestRelativePoint.x > screenWidthInPoints || latestRelativePoint.x < 0.0f || latestRelativePoint.y > screenHeightInPoints || latestRelativePoint.y < 0.0f); // boundary detection & coordinates reset to the central screen point for HK:StarTrail(needs a very high pointer velocity); // boundary detection & coordinates reset to the specific point for HK:StarTrail(needs a very high pointer velocity)
|
||||||
|
// must exclude touch pointer that uses native coords instead of relative ones.
|
||||||
return _boundaryReached;
|
return _boundaryReached;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +62,7 @@ StreamView *streamView;
|
|||||||
+ (void)initContextWithView:(StreamView *)view {
|
+ (void)initContextWithView:(StreamView *)view {
|
||||||
streamView = view;
|
streamView = view;
|
||||||
screenWidthInPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]);
|
screenWidthInPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]);
|
||||||
fixedResetCoordX = screenWidthInPoints * 0.5;
|
fixedResetCoordX = screenWidthInPoints * 0.3;
|
||||||
screenHeightInPoints = CGRectGetHeight([[UIScreen mainScreen] bounds]);
|
screenHeightInPoints = CGRectGetHeight([[UIScreen mainScreen] bounds]);
|
||||||
fixedResetCoordY = screenHeightInPoints * 0.4;
|
fixedResetCoordY = screenHeightInPoints * 0.4;
|
||||||
pointerObjDict = [NSMutableDictionary dictionary];
|
pointerObjDict = [NSMutableDictionary dictionary];
|
||||||
@@ -104,9 +106,13 @@ StreamView *streamView;
|
|||||||
+ (CGPoint)selectCoordsFor:(UITouch *)touch{
|
+ (CGPoint)selectCoordsFor:(UITouch *)touch{
|
||||||
NativeTouchPointer *pointer = [pointerObjDict objectForKey:@((uintptr_t)touch)];
|
NativeTouchPointer *pointer = [pointerObjDict objectForKey:@((uintptr_t)touch)];
|
||||||
if((pointer -> initialPoint).x > pointerVelocityDividerLocationByPoints){ //if first contact coords locates on the right side of divider.
|
if((pointer -> initialPoint).x > pointerVelocityDividerLocationByPoints){ //if first contact coords locates on the right side of divider.
|
||||||
|
pointer -> useRelativeCoords = true;
|
||||||
return pointer->latestRelativePoint;
|
return pointer->latestRelativePoint;
|
||||||
}
|
}
|
||||||
return [touch locationInView:streamView];
|
else{
|
||||||
|
pointer -> useRelativeCoords = false;
|
||||||
|
return[touch locationInView:streamView];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user