Esempio n. 1
0
        private void OnInertiaCompleted(object sender, Manipulation2DCompletedEventArgs e)
        {
            // Inertia portion completed.

            ClearTimer();

            if (_manualComplete && _manualCompleteWithInertia)
            {
                // Another inertia portion was requested

                _lastManipulationBeforeInertia = ConvertDelta(e.Total, _lastManipulationBeforeInertia);

                ManipulationInertiaStartingEventArgs inertiaArguments = new ManipulationInertiaStartingEventArgs(
                    _manipulationDevice,
                    LastTimestamp,
                    _currentContainer,
                    new Point(e.OriginX, e.OriginY),
                    ConvertVelocities(e.Velocities),
                    true);

                PushEvent(inertiaArguments);
            }
            else
            {
                // This is the last event in the sequence.

                ManipulationCompletedEventArgs completedArguments = ConvertCompletedArguments(e);

                RaiseManipulationCompleted(completedArguments);
            }

            _inertiaProcessor = null;
        }
Esempio n. 2
0
        private void OnManipulationCompleted(object sender, Manipulation2DCompletedEventArgs e)
        {
            // Manipulation portion completed.

            if (_manualComplete && !_manualCompleteWithInertia)
            {
                // This is the last event in the sequence.

                ManipulationCompletedEventArgs completedArguments = ConvertCompletedArguments(e);
                RaiseManipulationCompleted(completedArguments);
            }
            else
            {
                // This event will configure inertia, which will start after this event.

                _lastManipulationBeforeInertia = ConvertDelta(e.Total, null);

                ManipulationInertiaStartingEventArgs inertiaArguments = new ManipulationInertiaStartingEventArgs(
                    _manipulationDevice,
                    LastTimestamp,
                    _currentContainer,
                    new Point(e.OriginX, e.OriginY),
                    ConvertVelocities(e.Velocities),
                    false);

                PushEvent(inertiaArguments);
            }

            _manipulationProcessor = null;
        }
 protected override void OnManipulationInertiaStarting(ManipulationInertiaStartingEventArgs e)
 {
     base.OnManipulationInertiaStarting(e);
     e.TranslationBehavior = new InertiaTranslationBehavior { DesiredDeceleration = 0.0096 };
     e.ExpansionBehavior = new InertiaExpansionBehavior { DesiredDeceleration = 0.000096 };
     e.Handled = true;
 }
        void canvas_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingEventArgs e)
        {
            // Decrease the velocity of the Rectangle's movement by
            // 10 inches per second every second.
            // (10 inches * 96 DIPS per inch / 1000ms^2)
            e.TranslationBehavior = new InertiaTranslationBehavior()
            {
                InitialVelocity = e.InitialVelocities.LinearVelocity,
                DesiredDeceleration = 10.0 * 96.0 / (1000.0 * 1000.0)
            };

            // Decrease the velocity of the Rectangle's resizing by
            // 0.1 inches per second every second.
            // (0.1 inches * 96 DIPS per inch / (1000ms^2)
            e.ExpansionBehavior = new InertiaExpansionBehavior()
            {
                InitialVelocity = e.InitialVelocities.ExpansionVelocity,
                DesiredDeceleration = 0.1 * 96 / 1000.0 * 1000.0
            };

            // Decrease the velocity of the Rectangle's rotation rate by
            // 2 rotations per second every second.
            // (2 * 360 degrees / (1000ms^2)
            e.RotationBehavior = new InertiaRotationBehavior()
            {
                InitialVelocity = e.InitialVelocities.AngularVelocity,
                DesiredDeceleration = 720 / (1000.0 * 1000.0)
            };
            e.Handled = true;
        }
 /// <summary>
 /// Step: 5
 /// Use the ManipulationInertiaStarting event to set the desired deceleration value for the given manipulation behavior,
 /// e.g., ExpansionBehaviour and RotationBehaviour.
 /// After the ManipulationInertiaStarting is called,
 /// it will call ManipulationDelta until velocity becomes zero.
 /// Set initial velocity of the expansion behavior and desired deceleration here.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void centerImageView_ManipulationDelta(object sender, System.Windows.Input.ManipulationInertiaStartingEventArgs e)
 {
     e.ExpansionBehavior = new InertiaExpansionBehavior()
     {
         InitialVelocity     = e.InitialVelocities.ExpansionVelocity,
         DesiredDeceleration = 10.0 * 96.0 / 1000000.0
     };
 }
Esempio n. 6
0
 /// <summary>
 ///     Gets ManipulationCompletedEventArgs object out of ManipulationInertiaStartingEventArgs
 /// </summary>
 private ManipulationCompletedEventArgs GetManipulationCompletedArguments(ManipulationInertiaStartingEventArgs e)
 {
     Debug.Assert(_lastManipulationBeforeInertia != null);
     return(new ManipulationCompletedEventArgs(
                _manipulationDevice,
                LastTimestamp,
                _currentContainer,
                new Point(e.ManipulationOrigin.X, e.ManipulationOrigin.Y),
                _lastManipulationBeforeInertia,
                e.InitialVelocities,
                IsInertiaActive));
 }
Esempio n. 7
0
        void element_ManipulationInertiaStarting(object sender, System.Windows.Input.ManipulationInertiaStartingEventArgs e)
        {
            if (this.Element == null)
            {
                e.Cancel();
                return;
            }

            //start inertia on all gesture
            Gestures.ForEach(a => a.ManipulationInertiaStarting(e));

            //Debug.WriteLine("OnManipulationInertiaStarting");
            double ms = 1000.0;


            //base.OnManipulationInertiaStarting(e);
            // Decrease the velocity of the Rectangle's movement by
            // 10 inches per second every second.
            // (10 inches * 96 pixels per inch / 1000ms^2)
            //e.TranslationBehavior.DesiredDeceleration = 10 * 96.0 / (1000.0 * 1000.0);
            e.TranslationBehavior = new InertiaTranslationBehavior()
            {
                InitialVelocity     = e.InitialVelocities.LinearVelocity,
                DesiredDeceleration = 10.0 * 96.0 / (ms * ms)
            };

            // Decrease the velocity of the Rectangle's resizing by
            // 0.1 inches per second every second.
            // (0.1 inches * 96 pixels per inch / (1000ms^2)
            //e.ExpansionBehavior.DesiredDeceleration = 0.1 * 96 / 1000.0 * 1000.0;
            e.ExpansionBehavior = new InertiaExpansionBehavior()
            {
                InitialVelocity     = e.InitialVelocities.ExpansionVelocity,
                DesiredDeceleration = 0.1 * 96 / ms * ms
            };

            // Decrease the velocity of the Rectangle's rotation rate by
            // 2 rotations per second every second.
            // (2 * 360 degrees / (1000ms^2)
            //e.RotationBehavior.DesiredDeceleration = 720 / (1000.0 * 1000.0);
            e.RotationBehavior = new InertiaRotationBehavior()
            {
                InitialVelocity     = e.InitialVelocities.AngularVelocity,
                DesiredDeceleration = 720 / (ms * ms)
            };


            e.Handled = true;
        }
Esempio n. 8
0
        void Window_InertiaStarting(object sender, ManipulationInertiaStartingEventArgs e)
        {
            // Decrease the velocity of the Rectangle's movement by
            // 10 inches per second every second.
            // (10 inches * 96 pixels per inch / 1000ms^2)
            e.TranslationBehavior.DesiredDeceleration = 10.0 * 96.0 / (1000.0 * 1000.0);

            // Decrease the velocity of the Rectangle's resizing by
            // 0.1 inches per second every second.
            // (0.1 inches * 96 pixels per inch / (1000ms^2)
            e.ExpansionBehavior.DesiredDeceleration = 0.1 * 96 / (1000.0 * 1000.0);

            // Decrease the velocity of the Rectangle's rotation rate by
            // 2 rotations per second every second.
            // (2 * 360 degrees / (1000ms^2)
            e.RotationBehavior.DesiredDeceleration = 720 / (1000.0 * 1000.0);

            e.Handled = true;
        }
Esempio n. 9
0
        /// <summary>
        ///     Starts the inertia phase based on the results of a ManipulationInertiaStarting event.
        /// </summary>
        internal void BeginInertia(ManipulationInertiaStartingEventArgs e)
        {
            if (e.CanBeginInertia())
            {
                _inertiaProcessor            = new InertiaProcessor2D();
                _inertiaProcessor.Delta     += OnManipulationDelta;
                _inertiaProcessor.Completed += OnInertiaCompleted;

                e.ApplyParameters(_inertiaProcessor);

                // Setup a timer to tick the inertia to completion
                _inertiaTimer          = new DispatcherTimer();
                _inertiaTimer.Interval = TimeSpan.FromMilliseconds(15);
                _inertiaTimer.Tick    += new EventHandler(OnInertiaTick);
                _inertiaTimer.Start();
            }
            else
            {
                // This is the last event in the sequence.
                ManipulationCompletedEventArgs completedArguments = GetManipulationCompletedArguments(e);
                RaiseManipulationCompleted(completedArguments);
                PushEventsToDevice();
            }
        }
Esempio n. 10
0
 private void cProbe_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingEventArgs e)
 {
     DisplayEvent("ManipulationInertiaStarting");
     //tbFeedBack.Text += "ManipulationInertiaStarting\r\n";
 }
Esempio n. 11
0
 void c_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingEventArgs e)
 {
     e.Handled = true;
 }
Esempio n. 12
0
 /// <summary>
 /// Handles InerniaStarting event.
 /// </summary>
 /// <param name="sender">Event sender.</param>
 /// <param name="e">Event argument.</param>
 private void inertiaStarting(object sender, ManipulationInertiaStartingEventArgs e)
 {
     e.TranslationBehavior.DesiredDeceleration = 10.0 * 96.0 / (1000.0 * 1000.0);
     e.Handled = true;
 }
Esempio n. 13
0
 protected override void OnManipulationInertiaStarting(ManipulationInertiaStartingEventArgs e)
 {
     if (_panningInfo != null)
     {
         if (!_panningInfo.IsPanning && !ForceNextManipulationComplete)
         {
             // If the inertia starts and we are not scrolling yet, then cancel the manipulation.
             e.Cancel();
             _panningInfo = null;
         }
         else
         {
             e.TranslationBehavior.DesiredDeceleration = PanningDeceleration;
         }
         e.Handled = true;
     }
 }
Esempio n. 14
0
        private void startInertiaTranslation(ManipulationInertiaStartingEventArgs e)
        {
            //TRANSLATION: calculate the overall speedTranslation, depended on the final velocity of the fingers after lifting from the sim object
            double speedTranslation = e.InitialVelocities.LinearVelocity.Length * App.DpiFactor; //* 10.416; //the initial speedTranslation (depending on the dpi of the screen --> Magic Number for dpi of 96: 10.416 inch)
            double movementTimeInMS = this.ProtoDefinition.MoveManipulation.MovementTime * 1000.0;

            double msTillDistanceIsReached = (2 * this.ProtoDefinition.MoveManipulation.TravelDistance * App.UnitConversionFactor) / speedTranslation; //fixed distance
            //double distanceTraveledOverTime = (speedTranslation * movementTimeInMS) / 2; //fixed time

            //TRANSLATION: Calculate the deceleration delta
            switch (this.ProtoDefinition.MoveManipulation.FlickingBehavior)
            {
                case MoveManipulation.FLICK_MOVE_OVER_TIME: this.inertiaTranslationDecelDelta = (speedTranslation / movementTimeInMS) / App.DpiFactor; break; //equivalent formula: ((2 * distanceTraveledOverTime) / Math.Pow(movementTimeInMS, 2.0)) / App.DpiFactor; break;
                case MoveManipulation.FLICK_MOVE_OVER_DISTANCE: this.inertiaTranslationDecelDelta = (speedTranslation / msTillDistanceIsReached) / App.DpiFactor; break; //(((speedTranslation * speedTranslation) / (2 * this.ProtoDefinition.MoveManipulation.TravelDistance)) / App.DpiFactor) / (1000.0 * 1000.0); break;
                case MoveManipulation.FLICK_MOVE_CONSTANT:
                default: this.inertiaTranslationDecelDelta = ((this.ProtoDefinition.MoveManipulation.ConstantDeceleration * App.UnitConversionFactor) / App.DpiFactor) / (1000.0 * 1000.0); break;
            }
            this.inertiaTranslationVector = new Vector(e.InitialVelocities.LinearVelocity.X, e.InitialVelocities.LinearVelocity.Y);

            //Debug.log("Translation Inertia started; v_t = " + this.inertiaTranslationVector + "; decel = " + this.inertiaTranslationDecelDelta);

            //go go power rangers!
            this.IsInertialTranslation = true;
        }
Esempio n. 15
0
        private void startInertiaRotation(ManipulationInertiaStartingEventArgs e)
        {
            //ROTATION: speed and rotation centers, initial angulr velocity is measured in deg/s (NOT in rad!)
            double speedRotation = Math.Abs(e.InitialVelocities.AngularVelocity);
            double rotationTimeInMS = this.ProtoDefinition.RotateManipulation.RotationTime * 1000.0;

            double msTillAngleIsReached = (2 * this.ProtoDefinition.RotateManipulation.RotationToAngle) / speedRotation; //fixed distance
            //double angleTraveledOverTime = (speedRotation * rotationTimeInMS) / 2; //fixed angular distance

            //ROTATION: deceleration delta
            switch (this.ProtoDefinition.RotateManipulation.FlickingBehavior)
            {
                case RotateManipulation.FLICK_ROTATE_OVER_TIME: this.inertiaRotationDecelDelta = speedRotation / rotationTimeInMS; break; //equivalent formula: (2 * angleTraveledOverTime) / Math.Pow(rotationTimeInMS, 2.0); break;
                case RotateManipulation.FLICK_ROTATE_TO_ANGLE: this.inertiaRotationDecelDelta = speedRotation / msTillAngleIsReached; break; //fixed angular distance
                case RotateManipulation.FLICK_ROTATE_CONSTANT:
                default: this.inertiaRotationDecelDelta = this.ProtoDefinition.RotateManipulation.ConstantDeceleration / (1000.0 * 1000.0); break; //fixed deceleration in deg per seconds square
            }
            this.inertiaRotationAngle = Math.Abs(e.InitialVelocities.AngularVelocity);
            this.inertiaRotationDirection = Math.Sign(e.InitialVelocities.AngularVelocity);

            //and start..
            this.IsInertialRotation = true;
        }
Esempio n. 16
0
 /// <summary>
 ///     Gets ManipulationCompletedEventArgs object out of ManipulationInertiaStartingEventArgs 
 /// </summary>
 private ManipulationCompletedEventArgs GetManipulationCompletedArguments(ManipulationInertiaStartingEventArgs e) 
 { 
     Debug.Assert(_lastManipulationBeforeInertia != null);
     return new ManipulationCompletedEventArgs( 
         _manipulationDevice,
         LastTimestamp,
         _currentContainer,
         new Point(e.ManipulationOrigin.X, e.ManipulationOrigin.Y), 
         _lastManipulationBeforeInertia,
         e.InitialVelocities, 
         IsInertiaActive); 
 }
Esempio n. 17
0
        private void OnInertiaCompleted(object sender, Manipulation2DCompletedEventArgs e)
        { 
            // Inertia portion completed.
 
            ClearTimer(); 

            if (_manualComplete && _manualCompleteWithInertia) 
            {
                // Another inertia portion was requested

                _lastManipulationBeforeInertia = ConvertDelta(e.Total, _lastManipulationBeforeInertia); 

                ManipulationInertiaStartingEventArgs inertiaArguments = new ManipulationInertiaStartingEventArgs( 
                    _manipulationDevice, 
                    LastTimestamp,
                    _currentContainer, 
                    new Point(e.OriginX, e.OriginY),
                    ConvertVelocities(e.Velocities),
                    true);
 
                PushEvent(inertiaArguments);
            } 
            else 
            {
                // This is the last event in the sequence. 

                ManipulationCompletedEventArgs completedArguments = ConvertCompletedArguments(e);

                RaiseManipulationCompleted(completedArguments); 
            }
 
            _inertiaProcessor = null; 
        }
		public virtual void OnManipulationInertiaStarting(object sender, ManipulationInertiaStartingEventArgs e) { }
Esempio n. 19
0
		/// <summary>
		/// Manipulation inertia starting postprocess handler
		/// </summary>
		/// <param name="e">Event args</param>
		public virtual void PostprocessManipulationInertiaStarting(ManipulationInertiaStartingEventArgs e) { }
Esempio n. 20
0
 private static void OnManipulationInertiaStarting(object sender, ManipulationInertiaStartingEventArgs e)
 {
     e.TranslationBehavior.DesiredDeceleration = 25 * 96.0 / (1000.0 * 1000.0);
 }
Esempio n. 21
0
        private void PostProcessInput(object sender, ProcessInputEventArgs e)
        {
            InputEventArgs inputEventArgs = e.StagingItem.Input;

            if (inputEventArgs.Device == this)
            {
                RoutedEvent routedEvent = inputEventArgs.RoutedEvent;
                if (routedEvent == Manipulation.ManipulationDeltaEvent)
                {
                    ManipulationDeltaEventArgs deltaEventArgs = inputEventArgs as ManipulationDeltaEventArgs;
                    if (deltaEventArgs != null)
                    {
                        // During deltas, see if panning feedback is needed on the window
                        ManipulationDelta unusedManipulation = deltaEventArgs.UnusedManipulation;
                        _manipulationLogic.RaiseBoundaryFeedback(unusedManipulation, deltaEventArgs.RequestedComplete);
                        _manipulationLogic.PushEventsToDevice();

                        // If a Complete is requested, then pass it along to the manipulation processor
                        if (deltaEventArgs.RequestedComplete)
                        {
                            _manipulationLogic.Complete(/* withInertia = */ deltaEventArgs.RequestedInertia);
                            _manipulationLogic.PushEventsToDevice();
                        }
                        else if (deltaEventArgs.RequestedCancel)
                        {
                            Debug.Assert(!deltaEventArgs.IsInertial);
                            OnManipulationCancel();
                        }
                    }
                }
                else if (routedEvent == Manipulation.ManipulationStartingEvent)
                {
                    ManipulationStartingEventArgs startingEventArgs = inputEventArgs as ManipulationStartingEventArgs;
                    if (startingEventArgs != null && startingEventArgs.RequestedCancel)
                    {
                        OnManipulationCancel();
                    }
                }
                else if (routedEvent == Manipulation.ManipulationStartedEvent)
                {
                    ManipulationStartedEventArgs startedEventArgs = inputEventArgs as ManipulationStartedEventArgs;
                    if (startedEventArgs != null)
                    {
                        if (startedEventArgs.RequestedComplete)
                        {
                            // If a Complete is requested, pass it along to the manipulation processor
                            _manipulationLogic.Complete(/* withInertia = */ false);
                            _manipulationLogic.PushEventsToDevice();
                        }
                        else if (startedEventArgs.RequestedCancel)
                        {
                            OnManipulationCancel();
                        }
                        else
                        {
                            // Start ticking to produce delta events
                            ResumeAllTicking(); // Resumes the ticking of all the suspended devices on the thread
                            StartTicking();     // Ensures that we continue ticking or restart ticking for this device
                        }
                    }
                }
                else if (routedEvent == Manipulation.ManipulationInertiaStartingEvent)
                {
                    // Switching from using rendering for ticking to a timer at lower priority (handled by ManipulationLogic)
                    StopTicking();

                    // Remove all the manipulators so that we dont re-start manipulations accidentally
                    RemoveAllManipulators();

                    // Initialize inertia
                    ManipulationInertiaStartingEventArgs inertiaEventArgs = inputEventArgs as ManipulationInertiaStartingEventArgs;
                    if (inertiaEventArgs != null)
                    {
                        if (inertiaEventArgs.RequestedCancel)
                        {
                            OnManipulationCancel();
                        }
                        else
                        {
                            _manipulationLogic.BeginInertia(inertiaEventArgs);
                        }
                    }
                }
                else if (routedEvent == Manipulation.ManipulationCompletedEvent)
                {
                    _manipulationLogic.OnCompleted();
                    ManipulationCompletedEventArgs completedEventArgs = inputEventArgs as ManipulationCompletedEventArgs;
                    if (completedEventArgs != null)
                    {
                        if (completedEventArgs.RequestedCancel)
                        {
                            Debug.Assert(!completedEventArgs.IsInertial);
                            OnManipulationCancel();
                        }
                        else if (!(completedEventArgs.IsInertial && _ticking))
                        {
                            // Remove the manipulation device only if
                            // another manipulation didnot start
                            OnManipulationComplete();
                        }
                    }
                }
                else if (routedEvent == Manipulation.ManipulationBoundaryFeedbackEvent)
                {
                    ManipulationBoundaryFeedbackEventArgs boundaryEventArgs = inputEventArgs as ManipulationBoundaryFeedbackEventArgs;
                    if (boundaryEventArgs != null)
                    {
                        _compensateForBoundaryFeedback = boundaryEventArgs.CompensateForBoundaryFeedback;
                    }
                }
            }
        }
Esempio n. 22
0
 /// <summary>
 /// Handles the ManipulationInertiaStarting event of the River control. Sets inertia properties.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.Windows.Input.ManipulationInertiaStartingEventArgs"/> instance containing the event data.</param>
 private void River_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingEventArgs e)
 {
     e.TranslationBehavior.InitialVelocity = e.InitialVelocities.LinearVelocity;
     e.TranslationBehavior.DesiredDeceleration = (20.0 * 96.0) / 1000000.0;
 }
Esempio n. 23
0
        /// <summary>
        ///     Starts the inertia phase based on the results of a ManipulationInertiaStarting event.
        /// </summary>
        internal void BeginInertia(ManipulationInertiaStartingEventArgs e) 
        {
            if (e.CanBeginInertia()) 
            { 
                _inertiaProcessor = new InertiaProcessor2D();
                _inertiaProcessor.Delta += OnManipulationDelta; 
                _inertiaProcessor.Completed += OnInertiaCompleted;

                e.ApplyParameters(_inertiaProcessor);
 
                // Setup a timer to tick the inertia to completion
                _inertiaTimer = new DispatcherTimer(); 
                _inertiaTimer.Interval = TimeSpan.FromMilliseconds(15); 
                _inertiaTimer.Tick += new EventHandler(OnInertiaTick);
                _inertiaTimer.Start(); 
            }
            else
            {
                // This is the last event in the sequence. 
                ManipulationCompletedEventArgs completedArguments = GetManipulationCompletedArguments(e);
                RaiseManipulationCompleted(completedArguments); 
                PushEventsToDevice(); 
            }
        } 
Esempio n. 24
0
        /// <summary>
        /// Delegate the inertia implementation to the Manipulation objects
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Canvas_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingEventArgs e)
        {
            //getting the original Manipulation Origin Point
            this.inertiaManipulationOrigin = new Point()
            {
                X = e.ManipulationOrigin.X,
                Y = e.ManipulationOrigin.Y
            };

            //if inertia is activated setup the necessary variables
            if (this.ProtoDefinition.MoveManipulation.FlickingBehavior != MoveManipulation.FLICK_NONE)
            {
                this.startInertiaTranslation(e);
            }

            if (this.ProtoDefinition.RotateManipulation.FlickingBehavior != RotateManipulation.FLICK_NONE)
            {
                this.startInertiaRotation(e);
            }

            if (this.ProtoDefinition.ScaleManipulation.FlickingBehavior != ScaleManipulation.FLICK_NONE)
            {
                this.startInertiaScaling(e);
            }

            e.Handled = true;
        }
Esempio n. 25
0
        private void OnManipulationCompleted(object sender, Manipulation2DCompletedEventArgs e) 
        {
            // Manipulation portion completed.

            if (_manualComplete && !_manualCompleteWithInertia) 
            {
                // This is the last event in the sequence. 
 
                ManipulationCompletedEventArgs completedArguments = ConvertCompletedArguments(e);
                RaiseManipulationCompleted(completedArguments); 
            }
            else
            {
                // This event will configure inertia, which will start after this event. 

                _lastManipulationBeforeInertia = ConvertDelta(e.Total, null); 
 
                ManipulationInertiaStartingEventArgs inertiaArguments = new ManipulationInertiaStartingEventArgs(
                    _manipulationDevice, 
                    LastTimestamp,
                    _currentContainer,
                    new Point(e.OriginX, e.OriginY),
                    ConvertVelocities(e.Velocities), 
                    false);
 
                PushEvent(inertiaArguments); 
            }
 
            _manipulationProcessor = null;
        }
Esempio n. 26
0
        private void startInertiaScaling(ManipulationInertiaStartingEventArgs e)
        {
            Debug.log("scale: " + e.InitialVelocities.ExpansionVelocity + ", l: " + e.InitialVelocities.ExpansionVelocity.Length);
            double speedScaling = e.InitialVelocities.ExpansionVelocity.Length * App.DpiFactor; //the initial scaling speed
            double scalingTimeInMS = this.ProtoDefinition.ScaleManipulation.ScalingTime * 1000.0;

            double msTillFactorIsReached = (2 * this.ProtoDefinition.ScaleManipulation.ScaleDistance * App.UnitConversionFactor) / speedScaling; //fixed distance
            //double distanceTraveledOverTime = (speedTranslation * movementTimeInMS) / 2; //fixed time

            //TRANSLATION: Calculate the deceleration delta
            switch (this.ProtoDefinition.ScaleManipulation.FlickingBehavior)
            {
                case ScaleManipulation.FLICK_SCALE_OVER_TIME: this.inertiaScalingDecelDelta = (speedScaling / scalingTimeInMS) / App.DpiFactor; break; //equivalent formula: ((2 * distanceTraveledOverTime) / Math.Pow(movementTimeInMS, 2.0)) / App.DpiFactor; break;
                case ScaleManipulation.FLICK_SCALE_DISTANCE: this.inertiaScalingDecelDelta = (speedScaling / msTillFactorIsReached) / App.DpiFactor; break; //(((speedTranslation * speedTranslation) / (2 * this.ProtoDefinition.ScaleManipulation.ScaleDistance)) / App.DpiFactor) / (1000.0 * 1000.0); break;
                case ScaleManipulation.FLICK_SCALE_CONSTANT:
                default: this.inertiaScalingDecelDelta = ((this.ProtoDefinition.ScaleManipulation.ConstantDeceleration * App.UnitConversionFactor) / App.DpiFactor) / (1000.0 * 1000.0); break;
            }
            this.inertiaScalingVector = new Vector(e.InitialVelocities.ExpansionVelocity.X, e.InitialVelocities.ExpansionVelocity.Y);

            //Debug.log("Scaling speed length: " + speedScaling);
            //Debug.log("Scaling Inertia Started; v_s = " + this.inertiaScalingVector + "; decel = " + this.inertiaScalingDecelDelta + "; duration = " + msTillFactorIsReached + "ms");

            this.IsInertialScaling = true;
        }
Esempio n. 27
0
 protected override void OnManipulationInertiaStarting(ManipulationInertiaStartingEventArgs e)
 {
     base.OnManipulationInertiaStarting(e);
     e.TranslationBehavior.DesiredDeceleration = 0.001;
     e.RotationBehavior.DesiredDeceleration = 0.01;
     e.ExpansionBehavior.DesiredDeceleration = 0.01;
 }
Esempio n. 28
0
 private static void OnStaticManipulationInertiaStarting(object sender, ManipulationInertiaStartingEventArgs e)
 {
     Window window = sender as Window;
     if (window != null)
     {
         // Transitioning from direct manipulation to inertia, animate the window
         // back to its original position.
         window.EndPanningFeedback(true);
     }
 }
Esempio n. 29
0
 public virtual void ManipulationInertiaStarting(System.Windows.Input.ManipulationInertiaStartingEventArgs e)
 {
 }
		void ManipulationElement_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingEventArgs e) {
			foreach (var m in mouseProcessors) {
				if (e.Handled)
					break;
				m.PreprocessManipulationInertiaStarting(e);
			}
			if (!e.Handled)
				defaultMouseProcessor.OnManipulationInertiaStarting(sender, e);
			foreach (var m in mouseProcessors)
				m.PostprocessManipulationInertiaStarting(e);
		}
Esempio n. 31
0
        private void cTimeLine_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingEventArgs e)
        {
            if (!Timeline.CanChangeTimeInterval) return;
            if (e.InitialVelocities.LinearVelocity.X < -1 || e.InitialVelocities.LinearVelocity.X > 1)
                e.TranslationBehavior = new InertiaTranslationBehavior
                {
                    InitialVelocity = e.InitialVelocities.LinearVelocity,
                    DesiredDeceleration = Deceleration
                };

            e.Handled = true;
        }
Esempio n. 32
0
        /// <summary>
        /// Delegate the inertia implementation to the Manipulation objects
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Canvas_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingEventArgs e)
        {
            //this.ProtoDefinition.MoveManipulation.InertiaImplementation(sender, e);

            //this.ProtoDefinition.ScaleManipulation.InertiaImplementation(sender, e);

            //this.ProtoDefinition.RotateManipulation.InertiaImplementation(sender, e);

            e.Handled = true;
        }
 protected virtual void OnManipulationInertiaStarting(ManipulationInertiaStartingEventArgs e);
 protected override void OnManipulationInertiaStarting(ManipulationInertiaStartingEventArgs e)
 {
     base.OnManipulationInertiaStarting(e);
     e.TranslationBehavior = new InertiaTranslationBehavior { DesiredDeceleration = 0.0096 };
     e.ExpansionBehavior = new InertiaExpansionBehavior { DesiredDeceleration = 0.000096 };
     if (!_hasManipulationDelta)
     {
         PickerPoint = new Point((e.ManipulationOrigin.X + ZoomableCanvasOffset.X) / Scale, (e.ManipulationOrigin.Y + ZoomableCanvasOffset.Y) / Scale);
     }
     _hasManipulationDelta = false;
     e.Handled = true;
 }
Esempio n. 35
0
        private void ViewGrid_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingEventArgs e)
        {
            //Trägheitseffekte für die Touch-Manipulation des Raumplans
            //siehe auch http://msdn.microsoft.com/de-de/library/ee649090.aspx#Y1710

            // Decrease the velocity of the Rectangle's movement by
            // 10 inches per second every second.
            // (10 inches * 96 pixels per inch / 1000ms^2)
            e.TranslationBehavior.DesiredDeceleration = 10.0 * 96.0 / (1000.0 * 1000.0);

            // Decrease the velocity of the Rectangle's resizing by
            // 0.1 inches per second every second.
            // (0.1 inches * 96 pixels per inch / (1000ms^2)
            e.ExpansionBehavior.DesiredDeceleration = 0.1 * 96 / (1000.0 * 1000.0);

            // Decrease the velocity of the Rectangle's rotation rate by
            // 2 rotations per second every second.
            // (2 * 360 degrees / (1000ms^2)
            e.RotationBehavior.DesiredDeceleration = 720 / (1000.0 * 1000.0);

            e.Handled = true;
        }
Esempio n. 36
0
 void DramControl_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingEventArgs e)
 {
     e.TranslationBehavior.DesiredDeceleration = 0.002;
 }
Esempio n. 37
0
 void BeginInertia(object sender, ManipulationInertiaStartingEventArgs args) {
     args.TranslationBehavior.DesiredDeceleration = DECELERATION;
 }
Esempio n. 38
0
        private void Window_ManipulationInertiaStarting_1(object sender, ManipulationInertiaStartingEventArgs e)
        {
            LogMessage("Total X: " + totalX);
            LogMessage("Total Y: " + totalY);

            commander.ChangeDirection((short)totalX, (short)totalY);

            totalX = 0;
            totalY = 0;

            //((MatrixTransform)FlickPad.RenderTransform).Matrix = origin;
        }
Esempio n. 39
0
 public void OnManipulationInertiaStarting(object sender, System.Windows.Input.ManipulationInertiaStartingEventArgs e)
 {
     Console.WriteLine("ViewerContext got manipulation inertia started event.");
 }