diff --git a/Limelight/Input/NativeTouchPointer.m b/Limelight/Input/NativeTouchPointer.m index ede183ee..7511589c 100644 --- a/Limelight/Input/NativeTouchPointer.m +++ b/Limelight/Input/NativeTouchPointer.m @@ -17,12 +17,11 @@ static NSMutableDictionary *pointerObjDict; static CGFloat pointerVelocityFactor; static CGFloat pointerVelocityDivider; static CGFloat pointerVelocityDividerLocationByPoints; -static CGFloat screenHeightInPoints; -static CGFloat screenWidthInPoints; +static CGFloat streamViewHeight; +static CGFloat streamViewWidth; static CGFloat fixedResetCoordX; static CGFloat fixedResetCoordY; - -StreamView *streamView; +static StreamView* _streamView; @implementation NativeTouchPointer{ CGPoint initialPoint; @@ -35,15 +34,15 @@ StreamView *streamView; - (instancetype)initWithTouch:(UITouch *)touch{ self = [super init]; - self->initialPoint = [touch locationInView:streamView]; + self->initialPoint = [touch locationInView:_streamView]; self->latestPoint = self->initialPoint; self->latestRelativePoint = self->initialPoint; return self; } - (bool)doesNeedResetCoords{ - bool boundaryReached = (latestRelativePoint.x > screenWidthInPoints || latestRelativePoint.x < 0.0f || latestRelativePoint.y > screenHeightInPoints || latestRelativePoint.y < 0.0f); - bool withinExcludedArea = (initialPoint.x > screenWidthInPoints * (0.75) && initialPoint.x < screenWidthInPoints) && (initialPoint.y > screenHeightInPoints * (0.8) && initialPoint.y < screenHeightInPoints); + bool boundaryReached = (latestRelativePoint.x > streamViewWidth || latestRelativePoint.x < 0.0f || latestRelativePoint.y > streamViewHeight || latestRelativePoint.y < 0.0f); + bool withinExcludedArea = (initialPoint.x > streamViewWidth * (0.75) && initialPoint.x < streamViewWidth) && (initialPoint.y > streamViewHeight * (0.8) && initialPoint.y < streamViewHeight); _needResetCoords = (pointerVelocityFactor > 1.0f) && self->useRelativeCoords && boundaryReached && !withinExcludedArea; // 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. @@ -54,7 +53,7 @@ StreamView *streamView; - (void)updatePointerCoords:(UITouch *)touch{ previousPoint = latestPoint; - latestPoint = [touch locationInView:streamView]; + latestPoint = [touch locationInView:_streamView]; previousRelativePoint = latestRelativePoint; if(_needResetCoords){// boundary detection & coordinates reset to the central screen point for HK:StarTrail(needs a very high pointer velocity); // boundary detection & coordinates reset to specific point for HK:StarTrail(needs a very high pointer velocity) previousRelativePoint.x = fixedResetCoordX; @@ -65,11 +64,12 @@ StreamView *streamView; } + (void)initContextWithView:(StreamView *)view { - streamView = view; - screenWidthInPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]); - fixedResetCoordX = screenWidthInPoints * 0.3; - screenHeightInPoints = CGRectGetHeight([[UIScreen mainScreen] bounds]); - fixedResetCoordY = screenHeightInPoints * 0.4; + _streamView = view; + streamViewWidth = _streamView.frame.size.width; + fixedResetCoordX = streamViewWidth * 0.3; + streamViewHeight = _streamView.frame.size.height; + fixedResetCoordY = streamViewHeight * 0.4; + NSLog(@"stream wdith %f, stream height %f", streamViewWidth, streamViewHeight); pointerObjDict = [NSMutableDictionary dictionary]; pointerVelocityDividerLocationByPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]) * pointerVelocityDivider; NSLog(@"pointerVelocityDivider: %.2f", pointerVelocityDivider); @@ -116,7 +116,7 @@ StreamView *streamView; } else{ pointer -> useRelativeCoords = false; - return[touch locationInView:streamView]; + return[touch locationInView:_streamView]; } } diff --git a/Limelight/Limelight.xcdatamodeld/Moonlight v1.10.xcdatamodel/contents b/Limelight/Limelight.xcdatamodeld/Moonlight v1.10.xcdatamodel/contents index a658466d..2638bf44 100644 --- a/Limelight/Limelight.xcdatamodeld/Moonlight v1.10.xcdatamodel/contents +++ b/Limelight/Limelight.xcdatamodeld/Moonlight v1.10.xcdatamodel/contents @@ -36,7 +36,7 @@ - + diff --git a/Limelight/mul.lproj/iPad.xcstrings b/Limelight/mul.lproj/iPad.xcstrings index e0638778..0aad09f8 100644 --- a/Limelight/mul.lproj/iPad.xcstrings +++ b/Limelight/mul.lproj/iPad.xcstrings @@ -890,19 +890,19 @@ "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "允许竖屏 (启用后只允许在应用视图中转屏)" + "value" : "允许竖屏 (启用后只允许在应用视图中90度转屏)" } }, "zh-Hant" : { "stringUnit" : { "state" : "translated", - "value" : "允许竖屏 (启用后只允许在应用视图中转屏)" + "value" : "允许竖屏 (启用后只允许在应用视图中90度转屏)" } }, "zh-HK" : { "stringUnit" : { "state" : "translated", - "value" : "允许竖屏 (启用后只允许在应用视图中转屏)" + "value" : "允许竖屏 (启用后只允许在应用视图中90度转屏)" } } } diff --git a/Limelight/mul.lproj/iPhone.xcstrings b/Limelight/mul.lproj/iPhone.xcstrings index bf6a4bb2..a7a4e7bf 100644 --- a/Limelight/mul.lproj/iPhone.xcstrings +++ b/Limelight/mul.lproj/iPhone.xcstrings @@ -2102,19 +2102,19 @@ "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "允许竖屏 (启用后只允许在应用视图中转屏)" + "value" : "允许竖屏 (启用后只允许在应用视图中90度转屏)" } }, "zh-Hant" : { "stringUnit" : { "state" : "translated", - "value" : "允许竖屏 (启用后只允许在应用视图中转屏)" + "value" : "允许竖屏 (启用后只允许在应用视图中90度转屏)" } }, "zh-HK" : { "stringUnit" : { "state" : "translated", - "value" : "允许竖屏 (启用后只允许在应用视图中转屏)" + "value" : "允许竖屏 (启用后只允许在应用视图中90度转屏)" } } }