-api-id | -api-type | ms.custom |
---|---|---|
M:Windows.UI.Composition.Interactions.InteractionTracker.TryUpdatePositionBy(Windows.Foundation.Numerics.Vector3) |
winrt method |
RS5 |
Tries to adjust the InteractionTracker's position by the specified amount.
The TryUpdatePositionBy method updates the current location of InteractionTracker by the Vector3 delta specified as a parameter. Similarly to TryUpdatePosition, TryUpdatePositionBy is used to declaratively move InteractionTracker by a defined delta without the need of an animation or Inertia. TryUpdatePositionBy can be called from either the Idle, CustomAnimation or Inertia state – doing so will move the position of InteractionTracker by the defined delta and enter the idle state.
The value to add to the current position.
Returns the request ID. On state transitions, the request which caused the change in state will be included in the args. These IDs will start at 1 and increase with each try call during the lifetime of the application.
If InteractionTracker is in its Interacting State (user actively manipulating), and TryUpdatePositionBy is called, the system will ignore this request – an event gets fired when this occurs that can be listened for. If sent from one of the other states, listen for the event fired for IdleStateEntered and check the RequestId property that identifies which request triggered the callback. The table below summarizes the expected behavior when this method is called in a particular state:
Current State | Outcome |
---|---|
Idle | Property updates to requested value, no state changes |
Interacting | Request ignored |
Inertia | Property updates to requested value, state changes to Idle |
CustomAnimation | Property updates to requested value, state changes to Idle |
public void InertiaStateEntered(InteractionTracker sender, InteractionTrackerInertiaStateEnteredArgs args)
{
// For sample purpose, will overwrite Inertia motion definitions by moving InteractionTracker to a specified position based on a delta
_tracker.TryUpdatePositionBy(new Vector3(50f));}
}