Udostępnij za pośrednictwem


InteractionTracker.TryUpdateScale(Single, Vector3) Method

Definition

Tries to update the scale to the specified value.

The TryUpdateScale method updates the scale location of InteractionTracker to the Scale position and centerpoint specified as a parameter. TryUpdateScale is used to declaratively define the scale of InteractionTracker at any point in time (either at start, from some state-entered event, etc.). TryUpdateScale can be called from either the Idle, CustomAnimation or Inertia state – doing so will move the scale position of InteractionTracker to the defined position and enter the idle state.

public:
 virtual int TryUpdateScale(float value, float3 centerPoint) = TryUpdateScale;
int TryUpdateScale(float const& value, float3 const& centerPoint);
public int TryUpdateScale(float value, Vector3 centerPoint);
function tryUpdateScale(value, centerPoint)
Public Function TryUpdateScale (value As Single, centerPoint As Vector3) As Integer

Parameters

value
Single

float

The new value for scale.

centerPoint
Vector3 Vector3

float3

The new center point.

Returns

Int32

int

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.

Examples

void SetupInteractionTracker()
{
  // Setup InteractionTracker
  _tracker = InteractionTracker.Create(_compositor);
  _interactionSource.PositionXSourceMode = InteractionSourceMode.EnabledWithInertia;
  _interactionSource.PositionYSourceMode = InteractionSourceMode.EnabledWithInertia;

  _tracker.InteractionSources.Add(_interactionSource);
  _tracker.PositionInertiaDecayRate = new Vector3(0.95f);

  // Update the scale position of InteractionTracker
  _tracker.TryUpdateScale(0.5f, new Vector3(50f));
}

Remarks

If InteractionTracker is in its Interacting State (user actively manipulating), and TryUpdateScale 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 StateOutcome
IdleProperty updates to requested value, no state changes
InteractingRequest ignored
InertiaProperty updates to requested value, state changes to Idle
CustomAnimationProperty updates to requested value, state changes to Idle

Applies to