Inheritance: Windows.UI.Xaml.RoutedEventArgs, IManipulationDeltaRoutedEventArgs
        private void HypothesesView_ManipulationDelta(object sender, Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs e)
        {
            //_currentCumulativeDelta += e.Delta.Translation.Y;
            var moveIndexBy = Math.Floor(e.Cumulative.Translation.Y / (HypothesisViewModel.DefaultSize + GAP));

            //_currentCumulativeDelta -= moveIndexBy*(HypothesisViewModel.DefaultSize + GAP);

            var current = _lastVisibleIndex;

            updateLastVisibleIndex(_scrollStartLastIndex - (int)moveIndexBy);

            if (current != _lastVisibleIndex)
            {
                _currentCumulativeDelta = 0;
                updateRendering();
            }
            else
            {
                var movePixelBy = e.Cumulative.Translation.Y + (_lastVisibleIndex - _scrollStartLastIndex) * (HypothesisViewModel.DefaultSize + GAP);
                //Debug.WriteLine(movePixelBy);
                //Debug.WriteLine(_lastVisibleIndex);
                //Debug.WriteLine(_scrollStartLastIndex);
                foreach (var hypo in _hypothesesViewModel.HypothesisViewModels)
                {
                    hypo.DeltaTargetPosition = new Pt(0, Math.Sign(movePixelBy) * Math.Sqrt(Math.Abs(movePixelBy)));
                }
            }
        }
        private void rect觸控測試區_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            Debug.WriteLine("ManipulationDelta");

            if (e.Cumulative.Translation.X > 150)
            {
                Refresh手勢操作結果("向右滑動");
                e.Handled = true;
            }
            else if (e.Cumulative.Translation.X < -150)
            {
                Refresh手勢操作結果("向左滑動");
                e.Handled = true;
            }
            else if (e.Cumulative.Translation.Y > 150)
            {
                Refresh手勢操作結果("向下滑動");
                e.Handled = true;
            }
            else if (e.Cumulative.Translation.Y < -150)
            {
                Refresh手勢操作結果("向上滑動");
                e.Handled = true;
            }
        }
        private void OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            if (_panel.ItemsFitContent)
            {
                return;
            }

            double deltaX = e.Delta.Translation.X;

            if (e.IsInertial)
            {
                e.Complete();
            }
            else
            {
                if (Math.Abs(e.Cumulative.Translation.X) >= this.ItemWidthEx)
                {
                    e.Complete();
                }
                else
                {
                    _headerContainer.TranslateDeltaX(deltaX);
                    _panelContainer.TranslateDeltaX(deltaX);
                    if (Math.Sign(deltaX) > 0)
                    {
                        _tabsContainer.TranslateDeltaX(deltaX * _tabs.PrevTabWidth / this.ItemWidthEx);
                    }
                    else
                    {
                        _tabsContainer.TranslateDeltaX(deltaX * _tabs.SelectedTabWidth / this.ItemWidthEx);
                    }
                }
            }
            e.Handled = true;
        }
 private void DeltaImageManipulation(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     Image block = (Image)sender;
     _thickness.Left = block.Margin.Left + e.Delta.Translation.X;
     _thickness.Top = block.Margin.Top + e.Delta.Translation.Y;
     block.Margin = _thickness;
 }
        private void PaneContent_ManipulationDelta(object sender, Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs e)
        {
            DebugWrite($"OpenCloseMode {OpenCloseMode}");

            if (OpenCloseMode.HasFlag(OpenCloseModes.None))
            {
                return;
            }
            else if (OpenCloseMode.HasFlag(OpenCloseModes.Auto))
            {
                switch (e.PointerDeviceType)
                {
                case Windows.Devices.Input.PointerDeviceType.Pen:
                case Windows.Devices.Input.PointerDeviceType.Mouse:
                    return;
                }
            }
            else if (!OpenCloseMode.HasFlag(OpenCloseModes.Swipe))
            {
                return;
            }

            var threhold = 24;
            var delta    = e.Cumulative.Translation.X;

            if (delta < -threhold)
            {
                IsOpen = false;
            }
            else if (delta > threhold)
            {
                IsOpen = true;
            }
        }
        private void CaptureOnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs args)
        {
            //Not inertia
            if (args.IsInertial)
            {
                return;
            }

            var zoom = ViewModel.Zoom;
            if (zoom != null && zoom.Supported)
            {
                double max = args.Cumulative.Translation.Y;

                double halfHeight = Window.Current.Bounds.Height / 8;

                double delta = - (max / halfHeight);

                float value = currentZoom + Convert.ToInt32(delta) * 0.5f;

                if (value >= zoom.Min && value <= zoom.Max)
                {
                    zoom.Value = value;
                }

            }
        }
Exemple #7
0
 private void OnManipulationDelta(object Sender, ManipulationDeltaRoutedEventArgs DeltaRoutedEventArgs)
 {
     if (DeltaRoutedEventArgs.IsInertial)
     {
         if (_manipulationStartPoint.X - DeltaRoutedEventArgs.Position.X > 200)
         {
             _gameGrid.HandleMove(MoveDirection.Left);
             DeltaRoutedEventArgs.Complete();
             DeltaRoutedEventArgs.Handled = true;
         }
         else if (DeltaRoutedEventArgs.Position.X - _manipulationStartPoint.X > 200)
         {
             _gameGrid.HandleMove(MoveDirection.Right);
             DeltaRoutedEventArgs.Complete();
             DeltaRoutedEventArgs.Handled = true;
         }
         else if (_manipulationStartPoint.Y - DeltaRoutedEventArgs.Position.Y > 200)
         {
             _gameGrid.HandleMove(MoveDirection.Up);
             DeltaRoutedEventArgs.Complete();
             DeltaRoutedEventArgs.Handled = true;
         }
         else if (DeltaRoutedEventArgs.Position.Y - _manipulationStartPoint.Y > 200)
         {
             _gameGrid.HandleMove(MoveDirection.Down);
             DeltaRoutedEventArgs.Complete();
             DeltaRoutedEventArgs.Handled = true;
         }
     }
 }
        private void PaneContent_ManipulationDelta(object sender, Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs e)
        {
            DebugWrite($"OpenCloseMode {OpenCloseMode}");

            if (e.PointerDeviceType == PointerDeviceType.Mouse)
            {
                return;
            }
            if (e.PointerDeviceType == PointerDeviceType.Pen)
            {
                return;
            }
            switch (OpenCloseMode)
            {
            case OpenCloseModes.None:
            case OpenCloseModes.Tap:
                return;
            }

            var threshold = 24;
            var delta     = e.Cumulative.Translation.X;

            if (delta < -threshold)
            {
                IsOpen = false;
            }
            else if (delta > threshold)
            {
                IsOpen = true;
            }
        }
Exemple #9
0
        private void ScalableGrid_ManipulationDelta(object sender, Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs e)
        {
            //this.ManipulationMode = this.SetCurrentMainpulationModes();
            if (scaleTransform.ScaleX == 1 && scaleTransform.ScaleY == 1)
            {
                this.ManipulationMode = ManipulationModes.System | ManipulationModes.Scale;
            }
            else
            {
                this.ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.TranslateY | ManipulationModes.Scale | ManipulationModes.TranslateInertia;
            }

            scaleTransform.ScaleX *= e.Delta.Scale;
            scaleTransform.ScaleY *= e.Delta.Scale;
            if (scaleTransform.ScaleY < 0.5)
            {
                scaleTransform.ScaleX = scaleTransform.ScaleY = 0.5;
            }
            else if (scaleTransform.ScaleY > 4)
            {
                scaleTransform.ScaleX = scaleTransform.ScaleY = 4;

                translateTransform.X += e.Delta.Translation.X;
                translateTransform.Y += e.Delta.Translation.Y;
                StopWhenTranslateToEdge();
            }
        }
        private void theCanvas_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            if (isInInertion)
              {
            return;
              }
              var top = Canvas.GetTop(this.rect);
              var left = Canvas.GetLeft(this.rect);

              top += e.Delta.Translation.Y;
              left += e.Delta.Translation.X;

              var scale = e.Delta.Scale;

              //var oldWidth = this.rect.Width;
              //var oldHeight = this.rect.Height;

              //this.rect.Width *= scale;
              //this.rect.Height *= scale;

              //top -= (this.rect.Height - oldHeight) / 2;
              //left -= (this.rect.Width - oldWidth) / 2;

              Canvas.SetTop(this.rect, top);
              Canvas.SetLeft(this.rect, left);

              var transform = this.rect.RenderTransform as CompositeTransform;
              //transform.ScaleX += e.Delta.Scale / 100;
              //transform.ScaleY += e.Delta.Scale / 100;

              transform.CenterX = this.rect.Width / 2;
              transform.CenterY = this.rect.Height / 2;
              transform.Rotation += e.Delta.Rotation;
              //transform.Angle += e.Delta.Rotation;
        }
        private void ItemLayer_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            if (e.Cumulative.Translation.X != 0.0)
            {
                Grid itemlayer = (Grid)sender;
                var transform = (CompositeTransform)itemlayer.RenderTransform;
                User user = ((FrameworkElement)e.OriginalSource).DataContext as User;

                if (user == null) return;

                // Reveals Call
                if (e.Cumulative.Translation.X < -16 && Math.Abs(e.Cumulative.Translation.X) <= 128)
                {

                    transform.TranslateX = e.Cumulative.Translation.X;
                }



                // Reveals Email
                if (e.Cumulative.Translation.X > 16 && e.Cumulative.Translation.X <= 128)
                {

                    transform.TranslateX = e.Cumulative.Translation.X;
                }


                e.Handled = true;
            }
            else
            {
                e.Handled = false;
            }
        }
        private void OnPageManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            var delta = e.Delta;
            var translationDelta = delta.Translation;

            this.ViewModel.MovePlayer(translationDelta.Y);
        }
Exemple #13
0
 private void OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     if (e.PointerDeviceType != PointerDeviceType.Mouse)
     {
         TransformMap(e.Position, e.Delta.Translation, e.Delta.Rotation, e.Delta.Scale);
     }
 }
Exemple #14
0
        private void circlePanel_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            rotateTransform.CenterX = circlePanel.X;
            rotateTransform.CenterY = circlePanel.Y;

            storyboard.Begin();
            e.Complete();
        }
 private void Grid_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     k.Rotate(-e.Delta.Rotation/180.0 * Math.PI);
     k.Translate(e.Delta.Translation);
     if(e.Delta.Scale>0)
         k.Scale(e.Delta.Scale);
     G.Background = new SolidColorBrush(Colors.AliceBlue);
 }
 private void Ellipse_ManipulationDelta(object sender,
     ManipulationDeltaRoutedEventArgs e)
 {
     var elli = sender as Ellipse;
     var delta = e.Delta;
     this.ScaleEllipse(elli, delta);
     this.RotateEllipse(elli, delta);
     this.TranslateEllipse(elli, delta);
 }
 private async void OnAdornManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     double delta = e.Delta.Translation.Y;
     await TranslateDelta(delta);
     if (_cancelManipulation)
     {
         e.Complete();
     }
 }
Exemple #18
0
 private double Translate(CompositeTransform s, ManipulationDeltaRoutedEventArgs e, double floor, double ceiling)
 {
     var target = s.TranslateX + e.Delta.Translation.X;
     if (target < floor)
         return floor;
     if (target > ceiling)
         return ceiling;
     return target;
 }
Exemple #19
0
 private void RightHandle_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     var t = (sender as Grid).RenderTransform as CompositeTransform;
     var x = (LeftHandle.RenderTransform as CompositeTransform).TranslateX;
     var f = x + this.Size * .5;
     var c = this.Range;
     t.TranslateX = Translate(t, e, f, c);
     RightHandleText.Text = Text(t.TranslateX);
 }
        protected override void OnManipulationDelta(ManipulationDeltaRoutedEventArgs e)
        {
            base.OnManipulationDelta(e);

            if (Action != null)
            {
                Action.OnManipulationDelta(e);
            }
        }
 private void CameraImage_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     this.CameraImageCompositeTransform.TranslateX += e.Delta.Translation.X;
     this.CameraImageCompositeTransform.TranslateY += e.Delta.Translation.Y;
     this.CameraContentClipCompositeTransform.TranslateX += e.Delta.Translation.X;
     this.CameraContentClipCompositeTransform.TranslateY += e.Delta.Translation.Y;
     this.Render();
     e.Handled = true;
 }
Exemple #22
0
        private async void Control_ManipulationDelta(object sender, Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs e)
        {
            //Debug.WriteLine("Control_ManipulationDelta");

            Element.ViewPoint = Element.ViewPoint.Offset(-e.Delta.Translation.X / Element.ViewScale, -e.Delta.Translation.Y / Element.ViewScale);

            DrawImage = await Element.DrawImmageRequestAsync(Element.ViewPoint, Matrix2.Enlargement(ViewSize, 1 / Element.ViewScale, 1 / Element.ViewScale));

            Control.Invalidate();
        }
        void MonitorManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            if (Movement != null)
                Movement(this, new MovementMonitorEventArgs { 
                    X = _xOffsetStartValue + e.Cumulative.Translation.X,
                    Y = _yOffsetStartValue + e.Cumulative.Translation.Y
                });

			e.Handled = true;
        }
Exemple #24
0
        private void RootManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            DxPanel.Pitch = NormalizeAngle(
                DxPanel.Pitch + e.Delta.Translation.Y * 0.005);

            DxPanel.Yaw = NormalizeAngle(
                DxPanel.Yaw + e.Delta.Translation.X * 0.005);

            DxPanel.Scale *= e.Delta.Scale;
        }
Exemple #25
0
 private void Rectangle_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     if (e.Delta.Scale > 0)
     {
         rectangleScaleTransform.ScaleX = rectangleScaleTransform.ScaleX * e.Delta.Scale;
         rectangleScaleTransform.ScaleY = rectangleScaleTransform.ScaleY * e.Delta.Scale;
     }
     //rectangleTranslateTransform.X += e.Delta.Translation.X;
     //rectangleTranslateTransform.Y += e.Delta.Translation.Y;
 }
Exemple #26
0
        private void Drawer_ManipulationDelta(object sender, Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs e)
        {
            if (this.shouldAnimate)
            {
                double cumulativeTranslation = 0;
                double animationDistance     = 0;
                switch (this.DrawerLocation)
                {
                case DrawerLocation.Left:
                    cumulativeTranslation = -e.Cumulative.Translation.X;
                    animationDistance     = this.drawer.Width;
                    break;

                case DrawerLocation.Right:
                    cumulativeTranslation = e.Cumulative.Translation.X;
                    animationDistance     = this.drawer.Width;
                    break;

                case DrawerLocation.Top:
                    cumulativeTranslation = -e.Cumulative.Translation.Y;
                    animationDistance     = this.drawer.Height;
                    break;

                case DrawerLocation.Bottom:
                    cumulativeTranslation = e.Cumulative.Translation.Y;
                    animationDistance     = this.drawer.Height;
                    break;
                }

                var offset = (cumulativeTranslation / animationDistance) * this.AnimationDuration.TimeSpan.Milliseconds;

                if (offset > this.AnimationDuration.TimeSpan.Milliseconds)
                {
                    offset = this.AnimationDuration.TimeSpan.Milliseconds;
                }
                else if (offset < 0)
                {
                    offset = 0;
                }

                this.Context.MainContentStoryBoardReverse.Seek(TimeSpan.FromMilliseconds(offset));
                this.Context.DrawerStoryBoardReverse.Seek(TimeSpan.FromMilliseconds(offset));

                if (offset == this.AnimationDuration.TimeSpan.Milliseconds && e.IsInertial)
                {
                    this.IsOpen        = false;
                    this.shouldAnimate = false;
                }
                else if (offset == 0 && e.IsInertial)
                {
                    this.IsOpen        = true;
                    this.shouldAnimate = false;
                }
            }
        }
Exemple #27
0
        private void ImageOnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            var image = (Image)sender;
            var transform = (CompositeTransform)image.RenderTransform;

            transform.ScaleX = startScale * e.Cumulative.Scale;
            transform.ScaleY = startScale * e.Cumulative.Scale;
            transform.TranslateX = startTranslation.X + e.Cumulative.Translation.X;
            transform.TranslateY = startTranslation.Y + e.Cumulative.Translation.Y;
            transform.Rotation = startRotation + e.Cumulative.Rotation;
        }
        private void Content_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            Matrix mx = tx.Matrix;

            var m = e.Delta;

            Translate(ref mx, m.Translation.X, m.Translation.Y);
            ScaleAt(ref mx, m.Scale, m.Scale, e.Position.X, e.Position.Y);
            RotateAt(ref mx, m.Rotation, e.Position.X, e.Position.Y);
            tx.Matrix = mx;
        }
 private void MapManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     if (manipulationActive)
     {
         map.TransformMap(e.Position, e.Delta.Translation, e.Delta.Rotation, e.Delta.Scale);
     }
     else
     {
         e.Complete();
     }
 }
        private void OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            Debug.WriteLine("OnManipulationDelta");

            if (_completed)
                return;
            _deltaDetected = true;
            EventHandler<ManipulationDeltaRoutedEventArgs> eventHandler = Delta;
            if (eventHandler == null)
                return;
            eventHandler(sender, e);
        }
 private void MyUserControl1_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     // if (e.IsInertial)
     {
         //      Debug.WriteLine("惯性了");
         var a = CompositeTransform3D1.RotationY + e.Delta.Translation.X;
         CompositeTransform3D1.RotationY = a % 360;
     }
     Debug.WriteLine(CompositeTransform3D1.RotationY);
     //(Storyboard1.Children[0] as DoubleAnimation).To =;
     //Storyboard1.Begin();
 }
        protected override void OnManipulationDelta(ManipulationDeltaRoutedEventArgs e)
        {
            base.OnManipulationDelta(e);
            // Update render transform to reflect manipulation deltas
            _transform.Rotation += e.Delta.Rotation;
            _transform.ScaleX += e.Delta.Scale - 1.0f;
            _transform.ScaleY += e.Delta.Scale - 1.0f;
            _transform.TranslateX += e.Delta.Translation.X;
            _transform.TranslateY += e.Delta.Translation.Y;

            e.Handled = true;
        }
        private void Scroller_ManipulationDelta(object sender, Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs e)
        {
            if (!IsPullToRefreshWithMouseEnabled || _contentTransform == null)
            {
                return;
            }

            if (e.PointerDeviceType != Windows.Devices.Input.PointerDeviceType.Mouse)
            {
                return;
            }

            if (e.Cumulative.Translation.Y <= 0 || _scroller.VerticalOffset >= 1)
            {
                _scroller.ChangeView(_scroller.HorizontalOffset, _scroller.VerticalOffset - e.Delta.Translation.Y, 1);
                return;
            }

            if (_startingVerticalOffset >= 1)
            {
                return;
            }

            // content is not "moved" automagically by the scrollviewer in this case
            // so we need to apply our own transformation.
            // and to do so we use a little Sin Easing.

            // how much "drag" to go to the max translation
            var mouseMaxDragDistance = 100;

            // make it harder to drag (life is not easy)
            double translationToUse = e.Cumulative.Translation.Y / 3;
            var    deltaCumulative  = Math.Min(translationToUse, mouseMaxDragDistance) / mouseMaxDragDistance;

            // let's do some quartic ease-out
            double f      = deltaCumulative - 1;
            var    easing = 1 + (f * f * f * (1 - deltaCumulative));

            var maxTranslation = 150;

            _contentTransform.TranslateY = easing * maxTranslation;

            if (_headerTransform != null)
            {
                _headerTransform.TranslateY = _contentTransform.TranslateY;
            }

            if (_footerTransform != null)
            {
                _footerTransform.TranslateY = _contentTransform.TranslateY;
            }
        }
        private void ExecuteScaleCommand(ManipulationDeltaRoutedEventArgs obj)
        {
            // TODO: Check how to scale Polygon
            Shape control = obj.OriginalSource as Shape;

            if (control == null)
            {
                return;
            }

            control.Width *= obj.Delta.Scale;
            control.Height *= obj.Delta.Scale;
        }
        void TouchArea_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            // get the movement on X axis
            _x += (float)e.Delta.Translation.X;

            // keep the pan within the bountry
            if (_x < -this.ImagePanel.ActualWidth / 2 || _x > 0) return;

            // set the pan rectangle's visual's offset
            _touchAreaVisual.Offset = new Vector3(_x, 0.0f, 0.0f);
            // kick off the effect visual's animation so to have both visuals' offset in sync
            _effectVisual.ConnectAnimation("Offset", _animation).Start();
        }
Exemple #36
0
 private void ManipDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     if (e.IsInertial && _manipulating)
     {
         var currentpoint = e.Position;
         if (currentpoint.X - _initialPoint.X >= 70) // swipe right
         {
             e.Complete();
             e.Handled = true;
             _manipulating = false;
             ViewModel.NavigateDetails();
         }
     }
 }
        protected override void OnManipulationDelta(ManipulationDeltaRoutedEventArgs args)
        {
            Image image = args.OriginalSource as Image;
            CompositeTransform transform = image.RenderTransform as CompositeTransform;
            transform.TranslateX += args.Delta.Translation.X;
            transform.TranslateY += args.Delta.Translation.Y;

            transform.ScaleX *= args.Delta.Scale;
            transform.ScaleY *= args.Delta.Scale;

            transform.Rotation += args.Delta.Rotation;

            base.OnManipulationDelta(args);
        }
        private bool HandleManipulationDelta(Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs e)
        {
            Point translation = e.Delta.Translation;

            if (translation.X != 0 || translation.Y != 0)
            {
                return(this.HandleGesture(new PanGesture()
                {
                    Position = this.primaryTouchPoint, CumulativeTranslation = e.Cumulative.Translation, DeltaTranslation = translation
                }));
            }

            return(false);
        }
        private void OnManipulationDelta(object sender, Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs e)
        {
            if (this.CheckForHandled && e.Handled)
            {
                return;
            }

            bool handled = this.HandleManipulationDelta(e) || this.isInHold;

            if (!this.gestureHandled)
            {
                this.gestureHandled = handled;
            }

            if (this.gestureHandled && !this.mouseCaptureReleased)
            {
                // release the mouse capture - e.g. we may have a button pressed but to perform a pan gesture
                this.ReleaseMouseCapture(e.Container);
                this.mouseCaptureReleased = true;
            }

            e.Handled = this.gestureHandled;
        }
Exemple #40
0
 private void ScalableGrid_ManipulationDelta(object sender, Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs e)
 => zoom(e.Delta.Scale, e.Delta.Translation.X, e.Delta.Translation.Y);
Exemple #41
0
 private void ScrollViewer_ManipulationDelta(object sender, Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs e)
 {
 }
        private void MainContent_ManipulationDelta(object sender, Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs e)
        {
            if (this.shouldAnimate)
            {
                double cumulativeTranslation = 0;
                double animationDistance     = 0;
                switch (this.DrawerLocation)
                {
                case DrawerLocation.Left:
                    cumulativeTranslation = e.Cumulative.Translation.X;
                    animationDistance     = this.drawer.Width;
                    break;

                case DrawerLocation.Right:
                    cumulativeTranslation = -e.Cumulative.Translation.X;
                    animationDistance     = this.drawer.Width;
                    break;

                case DrawerLocation.Top:
                    cumulativeTranslation = e.Cumulative.Translation.Y;
                    animationDistance     = this.drawer.Height;
                    break;

                case DrawerLocation.Bottom:
                    cumulativeTranslation = -e.Cumulative.Translation.Y;
                    animationDistance     = this.drawer.Height;
                    break;
                }

                var offset = (cumulativeTranslation / animationDistance) * this.AnimationDuration.TimeSpan.Milliseconds;

                if (offset > this.AnimationDuration.TimeSpan.Milliseconds)
                {
                    offset = this.AnimationDuration.TimeSpan.Milliseconds;
                }
                else if (offset < 0)
                {
                    offset = 0;
                    if (DrawerState != Primitives.DrawerState.Closed)
                    {
                        this.DrawerState = Primitives.DrawerState.Closed;
                    }
                }

                if (offset < this.AnimationDuration.TimeSpan.Milliseconds && offset > 0)
                {
                    if (this.DrawerState != Primitives.DrawerState.Moving)
                    {
                        this.Context.MainContentStoryBoard.Begin();
                        this.Context.DrawerStoryBoard.Begin();
                        this.Context.MainContentStoryBoard.Pause();
                        this.Context.DrawerStoryBoard.Pause();
                        this.DrawerState = Primitives.DrawerState.Moving;
                    }
                }

                this.Context.MainContentStoryBoard.Seek(TimeSpan.FromMilliseconds(offset));
                this.Context.DrawerStoryBoard.Seek(TimeSpan.FromMilliseconds(offset));

                if (offset == this.AnimationDuration.TimeSpan.Milliseconds && e.IsInertial)
                {
                    this.OpenDrawerWithoutAnimation();
                }
                else if (offset == 0 && e.IsInertial)
                {
                    this.CloseDrawerWithoutAnimation();
                }
            }
        }
        private void Grid_ManipulationDelta1(object sender, Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs e)
        {
            var grid = sender as Grid;

            grid.Width = grid.ActualWidth + e.Delta.Translation.X;
        }
Exemple #44
0
 private void RefreshLoadPanel_ManipulationDelta(object sender, Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs e)
 {
     TouchMove(e.Delta.Translation.Y);
     Debug.WriteLine("### Delta");
 }
 private void Control_ManipulationDelta(object sender, Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs e)
 {
     Process(e.Position.X, e.Position.Y);
 }