Skip to content

Commit 4671f6f

Browse files
Merge branch 'isxb-543-fix-touch-double-remove' of https://github.com/Unity-Technologies/InputSystem into isxb-543-fix-touch-double-remove
2 parents 355499c + c0d58cf commit 4671f6f

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

Packages/com.unity.inputsystem/InputSystem/Actions/InputInteractionContext.cs

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ public bool ControlIsActuated(float threshold = 0)
123123
/// Mark the interaction has having begun.
124124
/// </summary>
125125
/// <remarks>
126-
/// Note that this affects the current interaction only. There may be multiple interactions on a binding
127-
/// and arbitrary many interactions may concurrently be in started state. However, only one interaction
126+
/// This affects the current interaction only. There might be multiple interactions on a binding
127+
/// and arbitrary many interactions might concurrently be in started state. However, only one interaction
128128
/// (usually the one that starts first) is allowed to drive the action's state as a whole. If an interaction
129129
/// that is currently driving an action is canceled, however, the next interaction in the list that has
130130
/// been started will take over and continue driving the action.
@@ -161,13 +161,31 @@ public void Started()
161161
m_State.ChangePhaseOfInteraction(InputActionPhase.Started, ref m_TriggerState);
162162
}
163163

164+
/// <summary>
165+
/// Marks the interaction as being performed and then transitions back to <see cref="InputActionPhase.Waiting"/>
166+
/// to wait for input. This behavior is desirable for interaction events that are instant and reflect
167+
/// a transitional interaction pattern such as <see cref="Interactions.PressInteraction"/> or <see cref="Interactions.TapInteraction"/>.
168+
/// </summary>
169+
/// <remarks>
170+
/// Note that this affects the current interaction only. There might be multiple interactions on a binding
171+
/// and arbitrary many interactions might concurrently be in started state. However, only one interaction
172+
/// (usually the one that starts first) is allowed to drive the action's state as a whole. If an interaction
173+
/// that is currently driving an action is canceled, however, the next interaction in the list that has
174+
/// been started will take over and continue driving the action.
175+
/// </remarks>
164176
public void Performed()
165177
{
166178
if (m_TriggerState.phase == InputActionPhase.Waiting)
167179
m_TriggerState.startTime = time;
168180
m_State.ChangePhaseOfInteraction(InputActionPhase.Performed, ref m_TriggerState);
169181
}
170182

183+
/// <summary>
184+
/// Marks the interaction as being performed and then transitions into I <see cref="InputActionPhase.Started"/>
185+
/// to wait for an initial trigger condition to be true before being performed again. This behavior
186+
/// may be desirable for interaction events that reflect transitional interaction patterns but should
187+
/// be considered as started until a cancellation condition is true, such as releasing a button.
188+
/// </summary>
171189
public void PerformedAndStayStarted()
172190
{
173191
if (m_TriggerState.phase == InputActionPhase.Waiting)
@@ -176,6 +194,12 @@ public void PerformedAndStayStarted()
176194
phaseAfterPerformed: InputActionPhase.Started);
177195
}
178196

197+
/// <summary>
198+
/// Marks the interaction as being performed and then stays in that state waiting for an input to
199+
/// cancel the interactions active state. This behavior is desirable for interaction events that
200+
/// are active for a duration until a cancellation condition is true, such as <see cref="Interactions.HoldInteraction"/> or <see cref="Interactions.TapInteraction"/> where releasing
201+
/// the associated button cancels the interaction..
202+
/// </summary>
179203
public void PerformedAndStayPerformed()
180204
{
181205
if (m_TriggerState.phase == InputActionPhase.Waiting)
@@ -184,6 +208,16 @@ public void PerformedAndStayPerformed()
184208
phaseAfterPerformed: InputActionPhase.Performed);
185209
}
186210

211+
/// <summary>
212+
/// Marks the interaction as being interrupted or aborted. This is relevant to signal that the interaction
213+
/// pattern was not completed, for example, the user pressed and then released a button before the minimum
214+
/// time required for a <see cref="Interactions.HoldInteraction"/> to complete.
215+
/// </summary>
216+
/// <remarks>
217+
/// This is used by most existing interactions to cancel the transitions in the interaction state machine
218+
/// when a condition required to proceed turned false or other indirect requirements were not met, such as
219+
/// time-based conditions.
220+
/// </remarks>
187221
public void Canceled()
188222
{
189223
if (m_TriggerState.phase != InputActionPhase.Canceled)

0 commit comments

Comments
 (0)