internal static void ApplyParameters(InertiaRotationBehavior behavior, InertiaProcessor2D processor, double initialVelocity) { if (behavior != null && behavior.CanUseForInertia()) { InertiaRotationBehavior2D behavior2D = new InertiaRotationBehavior2D(); if (behavior._isInitialVelocitySet) { behavior2D.InitialVelocity = (float)AngleUtil.DegreesToRadians(behavior._initialVelocity); } else { behavior2D.InitialVelocity = (float)AngleUtil.DegreesToRadians(initialVelocity); } if (behavior._isDesiredDecelerationSet) { behavior2D.DesiredDeceleration = (float)AngleUtil.DegreesToRadians(behavior._desiredDeceleration); } if (behavior._isDesiredRotationSet) { behavior2D.DesiredRotation = (float)AngleUtil.DegreesToRadians(behavior._desiredRotation); } processor.RotationBehavior = behavior2D; } }
internal void ApplyParameters(InertiaProcessor2D processor) { processor.InitialOriginX = (float)ManipulationOrigin.X; processor.InitialOriginY = (float)ManipulationOrigin.Y; ManipulationVelocities velocities = InitialVelocities; InertiaTranslationBehavior.ApplyParameters(_translationBehavior, processor, velocities.LinearVelocity); InertiaRotationBehavior.ApplyParameters(_rotationBehavior, processor, velocities.AngularVelocity); InertiaExpansionBehavior.ApplyParameters(_expansionBehavior, processor, velocities.ExpansionVelocity); if (_inertiaParameters != null) { for (int i = 0, count = _inertiaParameters.Count; i < count; i++) { processor.SetParameters(_inertiaParameters[i]); } } }