Skip to content

Commit b44d01d

Browse files
committed
Simplify isInProgress
1 parent 263a383 commit b44d01d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

org.mixedrealitytoolkit.input/Readers/PinchInputReader.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ public class PinchInputReader : MonoBehaviour, IXRInputButtonReader
2929
/// </summary>
3030
private struct FallbackState
3131
{
32-
public bool isInProgress;
3332
public bool isPerformed;
3433
public bool wasPerformedThisFrame;
3534
public bool wasCompletedThisFrame;
@@ -215,7 +214,7 @@ public bool TryReadValue(out float value)
215214
}
216215

217216
value = m_fallbackState.value;
218-
return m_fallbackState.isInProgress;
217+
return value > 0;
219218
}
220219

221220
#endregion IXRInputButtonReader
@@ -236,8 +235,7 @@ private void UpdatePinchSelection()
236235
// We can use the data from the bound action to synthesize the other better than the hand joint logic will.
237236
if (!m_isSelectPolyfilled && !m_isTrackingStatePolyfilled)
238237
{
239-
m_fallbackState.isInProgress = ReadIsPerformed();
240-
m_fallbackState.value = m_fallbackState.isInProgress ? 1 : 0;
238+
m_fallbackState.value = ReadIsPerformed() ? 1 : 0;
241239
return;
242240
}
243241
else if (!m_isSelectValuePolyfilled && !m_isTrackingStatePolyfilled)
@@ -274,7 +272,6 @@ private void UpdatePinchSelection()
274272
m_fallbackState.wasCompletedThisFrame = !isPinched && m_fallbackState.isPerformed;
275273
m_fallbackState.isPerformed = isPinched;
276274
m_fallbackState.value = pinchAmount;
277-
m_fallbackState.isInProgress = pinchAmount > 0;
278275
}
279276
else
280277
{

0 commit comments

Comments
 (0)