Пример #1
0
 //update velocities, velocity = distance/time
 public void Update(ManipulationDeltaEventArgs e, float history)
 {
     float elappsedMS = stopwatch.ElapsedMilliseconds;
     if (elappsedMS == 0)
         elappsedMS = 1;
     InitialVelocity = InitialVelocity * history + ((VectorF)e.TranslationDelta * (1F - history)) / elappsedMS;
     InitialAngularVelocity = InitialAngularVelocity * history + (e.RotationDelta * (1F - history)) / elappsedMS;
     InitialExpansionVelocity = InitialExpansionVelocity * history + (e.ExpansionDelta * (1F - history)) / elappsedMS;
     stopwatch.Reset();
     stopwatch.Start();
 }
Пример #2
0
        private void ProcessManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            DrawingObject obj = FindObject(Point.Round(e.Location));
            
            if (obj == null)
                return;

            obj.Move(e.TranslationDelta.ToSize());
            obj.Rotate(-e.RotationDelta, Point.Round(e.Location));
            obj.Zoom(e.ScaleDelta, Point.Round(e.Location));
            
            Invalidate();
        }
Пример #3
0
        /// <summary>
        /// Handler for the touch events and gestures
        /// </summary>
        void ProcessManipulationDelta(object sender, Windows7.Multitouch.Manipulation.ManipulationDeltaEventArgs e)
        {
            double expectedv = _attachedElement.VerticalOffset - e.TranslationDelta.Height;
            double expectedh = _attachedElement.HorizontalOffset - e.TranslationDelta.Width;

            double actualv = Math.Min(_attachedElement.ScrollableHeight, Math.Max(0, expectedv));
            double actualh = Math.Min(_attachedElement.ScrollableWidth, Math.Max(0, expectedh));

            _attachedElement.ScrollToVerticalOffset(expectedv);
            _attachedElement.ScrollToHorizontalOffset(expectedh);

            _delta = new Vector(expectedh - actualh, expectedv - actualv);
        }
Пример #4
0
        //Update picture state
        private void ProcessManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            if (Picture == null)
                return;

            Picture.X += e.TranslationDelta.Width;
            Picture.Y += e.TranslationDelta.Height;

            Picture.Angle += e.RotationDelta * 180 / Math.PI;

            Picture.ScaleX *= e.ScaleDelta;
            Picture.ScaleY *= e.ScaleDelta;

            //Update inertia calculation. Take 40 percent from the previos data
            _inertiaParam.Update(e, 0.4F);
        }
Пример #5
0
            //Update picture state
            private void ProcessManipulationDelta(object sender, ManipulationDeltaEventArgs e)
            {
                if (Picture == null)
                    return;

                Picture.Translate = new SizeF(Picture.Translate.Width + e.TranslationDelta.Width,
                                    Picture.Translate.Height + e.TranslationDelta.Height);

                Picture.Angle += e.RotationDelta * (float)( 180 / Math.PI);

                Picture.ScalingFactor = new SizeF(Picture.ScalingFactor.Width * e.ScaleDelta, Picture.ScalingFactor.Height * e.ScaleDelta); 

                //Update inertia calculation. Take 40 percent from the previos data
                _inertiaParam.Update(e, 0.4F);

                _form.Invalidate();
            }
Пример #6
0
 /// <summary>
 /// Handler for the touch events and gestures
 /// </summary>
 void ProcessManipulationDelta(object sender, Windows7.Multitouch.Manipulation.ManipulationDeltaEventArgs e)
 {
     attachedElement.ScrollToVerticalOffset(attachedElement.VerticalOffset - e.TranslationDelta.Height);
     attachedElement.ScrollToHorizontalOffset(attachedElement.HorizontalOffset - e.TranslationDelta.Width);
 }
 private void UpdateValue(ManipulationDeltaEventArgs e)
 {
     Text = ((int)(_startValue + e.CumulativeTranslation.Width)).ToString();
 }