internal static void ApplyParameters(InertiaTranslationBehavior behavior, InertiaProcessor2D processor, Vector initialVelocity)
        {
            if (behavior != null && behavior.CanUseForInertia())
            {
                InertiaTranslationBehavior2D behavior2D = new InertiaTranslationBehavior2D();
                if (behavior._isInitialVelocitySet)
                {
                    behavior2D.InitialVelocityX = (float)behavior._initialVelocity.X;
                    behavior2D.InitialVelocityY = (float)behavior._initialVelocity.Y;
                }
                else
                {
                    behavior2D.InitialVelocityX = (float)initialVelocity.X;
                    behavior2D.InitialVelocityY = (float)initialVelocity.Y;
                }
                if (behavior._isDesiredDecelerationSet)
                {
                    behavior2D.DesiredDeceleration = (float)behavior._desiredDeceleration;
                }
                if (behavior._isDesiredDisplacementSet)
                {
                    behavior2D.DesiredDisplacement = (float)behavior._desiredDisplacement;
                }

                processor.TranslationBehavior = behavior2D;
            }
        }
Exemplo n.º 2
0
        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]);
                }
            }
        }
        internal static void ApplyParameters(InertiaTranslationBehavior behavior, InertiaProcessor2D processor, Vector initialVelocity)
        {
            if (behavior != null && behavior.CanUseForInertia())
            {
                InertiaTranslationBehavior2D behavior2D = new InertiaTranslationBehavior2D();
                if (behavior._isInitialVelocitySet)
                {
                    behavior2D.InitialVelocityX = (float)behavior._initialVelocity.X;
                    behavior2D.InitialVelocityY = (float)behavior._initialVelocity.Y;
                }
                else
                {
                    behavior2D.InitialVelocityX = (float)initialVelocity.X;
                    behavior2D.InitialVelocityY = (float)initialVelocity.Y;
                }
                if (behavior._isDesiredDecelerationSet)
                {
                    behavior2D.DesiredDeceleration = (float)behavior._desiredDeceleration;
                }
                if (behavior._isDesiredDisplacementSet)
                {
                    behavior2D.DesiredDisplacement = (float)behavior._desiredDisplacement;
                }

                processor.TranslationBehavior = behavior2D;
            }
        }