Exemplo n.º 1
0
        internal static void ApplyParameters(InertiaExpansionBehavior behavior, InertiaProcessor2D processor, Vector initialVelocity)
        {
            if (behavior != null && behavior.CanUseForInertia())
            {
                InertiaExpansionBehavior2D behavior2D = new InertiaExpansionBehavior2D();
                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._isDesiredExpansionSet)
                {
                    behavior2D.DesiredExpansionX = (float)behavior._desiredExpansion.X;
                    behavior2D.DesiredExpansionY = (float)behavior._desiredExpansion.Y;
                }
                if (behavior._isInitialRadiusSet)
                {
                    behavior2D.InitialRadius = (float)behavior._initialRadius;
                }

                processor.ExpansionBehavior = 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]);
                }
            }
        }
Exemplo n.º 3
0
        internal static void ApplyParameters(InertiaExpansionBehavior behavior, InertiaProcessor2D processor, Vector initialVelocity)
        {
            if (behavior != null && behavior.CanUseForInertia())
            {
                InertiaExpansionBehavior2D behavior2D = new InertiaExpansionBehavior2D();
                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._isDesiredExpansionSet)
                {
                    behavior2D.DesiredExpansionX = (float)behavior._desiredExpansion.X;
                    behavior2D.DesiredExpansionY = (float)behavior._desiredExpansion.Y;
                }
                if (behavior._isInitialRadiusSet)
                {
                    behavior2D.InitialRadius = (float)behavior._initialRadius;
                }

                processor.ExpansionBehavior = behavior2D;
            }
        }