共用方式為


InteractionTracker.TryUpdateScale(Single, Vector3) 方法

定義

嘗試將小數位數更新為指定的值。

TryUpdateScale 方法會將 InteractionTracker 的縮放位置更新為指定為參數的 Scale 位置和中心點。 TryUpdateScale 可用來以宣告方式定義任何時間點的 InteractionTracker 小數位數, (一開始、從某些狀態輸入的事件等 ) 。 TryUpdateScale 可以從 Idle、CustomAnimation 或 Inertia 狀態呼叫 ,這麼做會將 InteractionTracker 的縮放位置移至定義的位置,並進入閒置狀態。

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

參數

value
Single

float

小數位數的新值。

centerPoint
Vector3 Vector3

float3

新的中心點。

傳回

Int32

int

傳回要求識別碼。 在狀態轉換時,造成狀態變更的要求將會包含在引數中。 這些識別碼會從 1 開始,並在應用程式存留期期間,隨著每次嘗試呼叫而增加。

範例

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));
}

備註

如果 InteractionTracker 處於其互動狀態 (使用者主動操作) ,而且呼叫 TryUpdateScale,系統會忽略此要求 – 當發生可接聽此情況時,就會引發事件。 如果從其中一個其他狀態傳送,請接聽針對 IdleStateEntered 引發的事件,並檢查 RequestID 屬性,以識別觸發回呼的要求。

下表摘要說明以特定狀態呼叫此方法時的預期行為:

目前狀態成果
閒置要求值的屬性更新,沒有狀態變更
Interacting要求已忽略
慣性要求值的屬性更新,狀態變更為 Idle
CustomAnimation要求值的屬性更新,狀態變更為 Idle

適用於