Skip to content

Commit 79ca1ab

Browse files
committed
fix: Revert canvas scale factor
1 parent 4a7582c commit 79ca1ab

File tree

1 file changed

+18
-26
lines changed

1 file changed

+18
-26
lines changed

Assets/JCSUnity/Scripts/Input/JCS_TouchInput.cs

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,19 @@ public class JCS_TouchInput : JCS_Instance<JCS_TouchInput>
100100

101101
/* Setter & Getter */
102102

103-
public bool touched { get { return this.mTouched; } }
104-
public Vector2 deltaPos { get { return this.mDeltaPos; } }
105-
public Vector2 dragDistance { get { return this.mDragDistance; } }
106-
public Vector2 dragDisplacement { get { return this.mDragDisplacement; } }
107-
public bool dragging { get { return this.mDragging; } }
108-
public float touchTime { get { return this.mTouchTime; } }
103+
public bool touched { get { return mTouched; } }
104+
public Vector2 deltaPos { get { return mDeltaPos; } }
105+
public Vector2 dragDistance { get { return mDragDistance; } }
106+
public Vector2 dragDisplacement { get { return mDragDisplacement; } }
107+
public bool dragging { get { return mDragging; } }
108+
public float touchTime { get { return mTouchTime; } }
109109
#if (UNITY_ANDROID || UNITY_IPHIONE || UNITY_IOS)
110-
public bool multiTouch { get { return this.mMultiTouch; } }
111-
public float touchDistance { get { return this.mTouchDistance; } }
112-
public float touchDistanceDelta { get { return this.mTouchDistanceDelta; } }
113-
public int detectTouchCount { get { return this.mDetectTouchCount; } set { this.mDetectTouchCount = value; } }
110+
public bool multiTouch { get { return mMultiTouch; } }
111+
public float touchDistance { get { return mTouchDistance; } }
112+
public float touchDistanceDelta { get { return mTouchDistanceDelta; } }
113+
public int detectTouchCount { get { return mDetectTouchCount; } set { mDetectTouchCount = value; } }
114114
#else
115-
public JCS_MouseButton mouseType { get { return this.mMouseType; } set { this.mMouseType = value; } }
115+
public JCS_MouseButton mouseType { get { return mMouseType; } set { mMouseType = value; } }
116116
#endif
117117

118118
/* Functions */
@@ -186,14 +186,6 @@ private void WhenTouched()
186186
mDragDistance.x = JCS_Mathf.DistanceOfUnitVector(mDragStartPosition.x, dragEndPosition.x);
187187
mDragDistance.y = JCS_Mathf.DistanceOfUnitVector(mDragStartPosition.y, dragEndPosition.y);
188188

189-
// 標準視窗的變動係數.
190-
{
191-
float scaleFactor = JCS_Canvas.SCALE_FACTOR;
192-
193-
mDragDistance.x /= scaleFactor;
194-
mDragDistance.y /= scaleFactor;
195-
}
196-
197189
float xDiff = dragEndPosition.x - mDragStartPosition.x;
198190
float yDiff = dragEndPosition.y - mDragStartPosition.y;
199191

@@ -236,9 +228,9 @@ private void HandleMultiTouches()
236228
// Check if multitouch.
237229
if (Input.touchCount <= 1)
238230
{
239-
this.mMultiTouch = false;
240-
this.mTouchDistance = 0.0f;
241-
this.mTouchDistanceDelta = 0.0f;
231+
mMultiTouch = false;
232+
mTouchDistance = 0.0f;
233+
mTouchDistanceDelta = 0.0f;
242234
return;
243235
}
244236

@@ -255,15 +247,15 @@ private void HandleMultiTouches()
255247
float newTouchDistance = sumTotal / Input.touchCount;
256248

257249
// We start apply `delta` value by after the first multi touches.
258-
if (this.mMultiTouch)
250+
if (mMultiTouch)
259251
{
260-
this.mTouchDistanceDelta = newTouchDistance - this.mTouchDistance;
252+
mTouchDistanceDelta = newTouchDistance - mTouchDistance;
261253
}
262254

263-
this.mTouchDistance = newTouchDistance;
255+
mTouchDistance = newTouchDistance;
264256

265257
// Multi-touch starts!
266-
this.mMultiTouch = true;
258+
mMultiTouch = true;
267259
}
268260
#endif
269261
}

0 commit comments

Comments
 (0)