Esempio n. 1
0
        private void Sidebar_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            _triggerCompleted = true;

            double finalLeft = Canvas.GetLeft(Sidebar) + e.Delta.Translation.X;

            if (finalLeft < -375 || finalLeft > 0)
            {
                return;
            }

            Canvas.SetLeft(Sidebar, finalLeft);

            if (e.IsInertial && e.Velocities.Linear.X > 1)
            {
                _triggerCompleted = false;
                e.Complete();
                MoveLeft(SideMenuExpandedLeft);
            }

            if (e.IsInertial && e.Velocities.Linear.X < -1)
            {
                _triggerCompleted = false;
                e.Complete();
                MoveLeft(SideMenuCollapsedLeft);
            }

            if (e.IsInertial && Math.Abs(e.Velocities.Linear.X) <= 1)
            {
                e.Complete();
            }
        }
Esempio n. 2
0
        private void OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            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;
        }
Esempio n. 3
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;
         }
     }
 }
Esempio n. 4
0
        public void photoDragged(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            Grid photo = (Grid)sender;
            CompositeTransform transforms = (CompositeTransform)photo.RenderTransform;

            // Move the image
            transforms.TranslateX += e.Delta.Translation.X;
            transforms.TranslateY += e.Delta.Translation.Y;

            // Rotate the image
            double angle = calculateImageAngle(e.Cumulative.Translation);

            transforms.Rotation = angle;

            if (e.IsInertial)
            {
                PhotoPosition m = getPhotoPosition(photo);

                if (m == PhotoPosition.OffscreenLeft)
                {
                    e.Complete();
                    passCurrent();
                }
                else if (m == PhotoPosition.OffscreenTop)
                {
                    e.Complete();
                    superlikeCurrent();
                }
                else if (m == PhotoPosition.OffscreenRight)
                {
                    e.Complete();
                    likeCurrent();
                }
            }
        }
Esempio n. 5
0
        void SlideView_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
#endif
        {
            if (!IsSlideEnabled)
            {
                e.Complete();
                return;
            }

#if WINDOWS_PHONE
            var deltaManipulation = e.DeltaManipulation;
#elif NETFX_CORE
            var deltaManipulation = e.Delta;
#endif

            var rightOffset = Panel.GetOffset(SelectedIndex + 1);
            var leftOffset  = Panel.GetOffset(SelectedIndex - 1);

            double offset = Math.Max(rightOffset, Math.Min(leftOffset, _translate.X + deltaManipulation.Translation.X));
            _translate.X = offset;

#if NETFX_CORE
            if (e.IsInertial)
            {
                e.Complete();
            }
#endif
        }
Esempio n. 6
0
        private async void mainImage_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            //if (e.IsInertial)
            {
                PagePicture lpCurrent = (PagePicture)mainImage.Items[0];
                if (lpCurrent != null)
                {
                    Point currentpoint = e.Position;
                    if (currentpoint.X - initialpoint.X >= 5 && lpCurrent.Previous != null)//500 is the threshold value, where you want to trigger the swipe right event
                    {
                        await LibraryView.PictureImageLoad(lpCurrent.Previous, mainImage);

                        LibraryView.onPictureChanged(sender, new OnPictureChangedArgs(lpCurrent.Previous, "grid"));
                        e.Complete();
                    }
                    else if (currentpoint.X - initialpoint.X <= -5 && lpCurrent.Next != null)//500 is the threshold value, where you want to trigger the swipe right event
                    {
                        await LibraryView.PictureImageLoad(lpCurrent.Next, mainImage);

                        LibraryView.onPictureChanged(sender, new OnPictureChangedArgs(lpCurrent.Next, "grid"));
                        e.Complete();
                    }
                }
            }
        }
Esempio n. 7
0
        private void Ellipse_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            var max = EntGrid.Width / 2;
            var min = max * -1;

            if (sender is FrameworkElement uiElement)
            {
                if (uiElement.DataContext is LightPositionVm location)
                {
                    location.X += e.Delta.Translation.X;
                    location.Y += e.Delta.Translation.Y;
                    return;
                }

                var dragTranslation1 = uiElement.RenderTransform as TranslateTransform;
                if (dragTranslation1 == null)
                {
                    dragTranslation1          = new TranslateTransform();
                    uiElement.RenderTransform = dragTranslation1;
                }

                if (dragTranslation1.X > max)
                {
                    dragTranslation1.X = max;
                    e.Complete();
                    return;
                }
                else if (dragTranslation1.X < min)
                {
                    dragTranslation1.X = min;
                    e.Complete();
                    return;
                }

                if (dragTranslation1.Y > max)
                {
                    dragTranslation1.Y = max;
                    e.Complete();
                    return;
                }
                else if (dragTranslation1.Y < min)
                {
                    dragTranslation1.Y = min;
                    e.Complete();
                    return;
                }

                dragTranslation1.X += e.Delta.Translation.X;
                dragTranslation1.Y += e.Delta.Translation.Y;
            }
        }
Esempio n. 8
0
        private void ValidatePosition(CompositeTransform ct, ManipulationDeltaRoutedEventArgs deltaEventArgs = null)
        {
            Point point = element.TransformToVisual(Container).TransformPoint(new Point(0, 0));

            if (point.X <= 0)
            {
                if (deltaEventArgs != null)
                {
                    deltaEventArgs.Complete();
                }
                ct.TranslateX = 0;
                Rect rect = element.TransformToVisual(Container).TransformBounds(
                    new Rect(new Point(0, 0), element.RenderSize));
                ct.TranslateX = -rect.Left;
            }
            if (point.X + element.ActualWidth >= Container.ActualWidth)
            {
                if (deltaEventArgs != null)
                {
                    deltaEventArgs.Complete();
                }
                ct.TranslateX = 0;
                Rect rect = element.TransformToVisual(Container).TransformBounds(
                    new Rect(new Point(0, 0), element.RenderSize));
                ct.TranslateX = Container.ActualWidth - rect.Right;
            }
            if (point.Y <= 0)
            {
                if (deltaEventArgs != null)
                {
                    deltaEventArgs.Complete();
                }
                ct.TranslateY = 0;
                Rect rect = element.TransformToVisual(Container).TransformBounds(
                    new Rect(new Point(0, 0), element.RenderSize));
                ct.TranslateY = -rect.Top;
            }
            if (point.Y + element.ActualHeight >= Container.ActualHeight)
            {
                if (deltaEventArgs != null)
                {
                    deltaEventArgs.Complete();
                }
                ct.TranslateY = 0;
                Rect rect = element.TransformToVisual(Container).TransformBounds(
                    new Rect(new Point(0, 0), element.RenderSize));
                ct.TranslateY = Container.ActualHeight - rect.Bottom;
            }
        }
Esempio n. 9
0
        private void _ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            Point end = e.Position;

            e.Complete();
            if (Math.Abs(end.X - start.X) < 5 && Math.Abs(end.Y - start.Y) < 5)
            {
                return;
            }

            if (Math.Abs(end.X - start.X) > Math.Abs(end.Y - start.Y))
            {
                if (end.X - start.X > 0)
                {
                    Move(RIGHT);
                }
                else
                {
                    Move(LEFT);
                }
            }
            else
            {
                if (end.Y - start.Y > 0)
                {
                    Move(DOWN);
                }
                else
                {
                    Move(UP);
                }
            }
        }
        private void ManipulateMe_ManipulationDelta(
            object sender, ManipulationDeltaRoutedEventArgs e)
        {
            if (forceManipulationsToEnd)
            {
                e.Complete();
                return;
            }

            _previousTransform.Matrix = _transformGroup.Value;

            Point center = _previousTransform.TransformPoint(
                new Point(e.Position.X, e.Position.Y));

            _compositeTransform.CenterX = center.X;
            _compositeTransform.CenterY = center.Y;

            _compositeTransform.Rotation   = (e.Delta.Rotation * 180) / Math.PI;
            _compositeTransform.ScaleX     =
                _compositeTransform.ScaleY = e.Delta.Scale;
            _compositeTransform.TranslateX = e.Delta.Translation.X;
            _compositeTransform.TranslateY = e.Delta.Translation.Y;

            e.Handled = true;
        }
Esempio n. 11
0
        private void LayoutRoot_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            if (e.IsInertial)
            {
                e.Complete();
                return;
            }

            var height = (float)ActualHeight;
            var offset = _layout.Offset;

            if (Math.Abs(e.Cumulative.Translation.Y) > Math.Abs(e.Cumulative.Translation.X))
            {
                offset.Y = Math.Max(-height, Math.Min(height, offset.Y + (float)e.Delta.Translation.Y));

                var opacity = Math.Abs((offset.Y - -height) / height);
                if (opacity > 1)
                {
                    opacity = 2 - opacity;
                }

                _layer.Opacity = opacity;
            }

            _layout.Offset = offset;
            e.Handled      = true;
        }
Esempio n. 12
0
        private async void ManipDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            if (!e.IsInertial || !(e.Position.X - _initialPoint.X >= 70))
            {
                return;
            }
            if (!(e.Position.X - _initialPoint.X >= 70))
            {
                return;
            }
            await
            Utils.GetMainPageInstance()
            .Navigate(PageIndex.PageAnimeDetails,
                      new AnimeDetailsPageNavigationArgs(Id, Title, _item, this,
                                                         new SearchPageNavigationArgs
            {
                Query = ViewModelLocator.SearchPage.PrevQuery,
                Anime = _animeMode
            })
            {
                Source    = _animeMode ? PageIndex.PageSearch : PageIndex.PageMangaSearch,
                AnimeMode = _animeMode
            });

            e.Complete();
        }
Esempio n. 13
0
        private void mainGrid_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            distanceX = e.Cumulative.Translation.X;
            distanceY = e.Cumulative.Translation.Y;
            e.Complete();
            if (Math.Abs(distanceX) < 5 && Math.Abs(distanceY) < 5)
            {
                return;
            }
            if (Math.Abs(distanceX) > Math.Abs(distanceY))
            {
                if (distanceX > 0)
                {
                    MoveRight();
                }

                else
                {
                    MoveLeft();
                }
            }
            else
            {
                if (distanceY > 0)
                {
                    MoveDown();
                }

                else
                {
                    MoveUp();
                }
            }
        }
Esempio n. 14
0
 private void SlideHandle_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     if (e.Cumulative.Translation.X >= 25)
     {
         e.Complete();
         IsIndexPanelOpen = !IsIndexPanelOpen;
     }
 }
Esempio n. 15
0
 private void IndexPanel_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     if (e.Cumulative.Translation.X <= -25)
     {
         e.Complete();
         IsIndexPanelOpen = false;
     }
 }
Esempio n. 16
0
        private void circlePanel_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            rotateTransform.CenterX = circlePanel.X;
            rotateTransform.CenterY = circlePanel.Y;

            storyboard.Begin();
            e.Complete();
        }
 private void AppBarHintButton_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     e.Handled = true;
     if (e.Cumulative.Translation.Y < -25)
     {
         e.Complete();
         AppBarHint_Click(sender, null);
     }
 }
Esempio n. 18
0
        void OnDragDraw(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            if (isrota != VModel.vm.DrawRotation)
            {
                ResizePanel();
                isrota = VModel.vm.DrawRotation;
            }
            while (true)//switch
            {
                //if(this.DrawMode==PointerDeviceType.Mouse && e.PointerDeviceType == PointerDeviceType.Mouse && e.)break;
                if (this.DrawMode == PointerDeviceType.Touch && this.CurrentTouchCount >= 2)
                {
                    break;
                }
                if (this.DrawMode == PointerDeviceType.Pen && e.PointerDeviceType != PointerDeviceType.Pen)
                {
                    break;
                }
                if (State == MyEnum.Move2)
                {
                    break;
                }
                return;
            }
            var d = e.Delta;
            var t = new TransformGroup();

            t.Children.Add(CANVAS.RenderTransform);
            t.Children.Add(new TranslateTransform()
            {
                X = d.Translation.X, Y = d.Translation.Y
            });

            t.Children.Add(new RotateTransform()
            {
                Angle = isrota?d.Rotation:0, CenterX = ROOT.ActualWidth / 2, CenterY = ROOT.ActualHeight / 2
            });

            t.Children.Add(new ScaleTransform()
            {
                ScaleX = d.Scale, ScaleY = d.Scale, CenterX = ROOT.ActualWidth / 2, CenterY = ROOT.ActualHeight / 2
            });
            Scale *= d.Scale;

            if (!CheckMatrix(t.Value))
            {
                if (Ev.Count == 0)
                {
                    e.Complete();
                }
                return;
            }
            CANVAS.RenderTransform = new MatrixTransform()
            {
                Matrix = t.Value
            };
        }
Esempio n. 19
0
        private void LOReaderView_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            if (_forcemanipulation2end || (e.IsInertial && is_horizontal))
            {
                e.Complete();
            }
            if (_ismanipulationenable && !_islocked)
            {
                if (_pointers < 2)
                {
                    if (!_deltatested)
                    {
                        _deltatested = true;
                        if (Math.Abs(e.Delta.Translation.Y / 2) < Math.Abs(e.Delta.Translation.X))
                        {
                            is_horizontal = true;
                        }
                        else
                        {
                            is_vertical = true; _ismanipulationenable = false;
                        }
                    }

                    if (is_horizontal)
                    {
                        if (_currentposition < _initthreshold && _currentposition > _finalthreshold)
                        {
                            delta_proportion = 1.0;
                        }
                        else
                        {
                            delta_proportion = 0.4;
                        }
                        _currentposition      += (e.Delta.Translation.X * delta_proportion);
                        _page_translation     += (e.Delta.Translation.X * delta_proportion);
                        _ctrasnform.TranslateX = _currentposition;
                    }

                    if (is_vertical)
                    {
                        //_elementslist[_currentindex].DeltaY = e.Delta.Translation.Y;
                    }
                }
                else
                {
                    //manipulation for the element to thumb

                    /*this.Opacity = 0.0;
                     * _elementtransform.TranslateX += e.Delta.Translation.X;
                     * _elementtransform.TranslateY += e.Delta.Translation.Y;
                     * _elementtransform.ScaleX *= e.Delta.Scale;
                     * _elementtransform.ScaleY *= e.Delta.Scale;
                     * _elementtransform.Rotation += e.Delta.Rotation;*/
                }
            }
        }
Esempio n. 20
0
        void rotateGrid_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            try
            {
                if (Completed)
                {
                    (this.GetTemplateChild(gridText) as Grid).Visibility = Visibility.Visible;
                    double a, b, c;
                    a      = Math.Sqrt((centerPoint.X - oldPoint.X) * (centerPoint.X - oldPoint.X) + (centerPoint.Y - oldPoint.Y) * (centerPoint.Y - oldPoint.Y));
                    b      = Math.Sqrt((centerPoint.X - e.Position.X) * (centerPoint.X - e.Position.X) + (centerPoint.Y - e.Position.Y) * (centerPoint.Y - e.Position.Y));
                    c      = Math.Sqrt((oldPoint.X - e.Position.X) * (oldPoint.X - e.Position.X) + (oldPoint.Y - e.Position.Y) * (oldPoint.Y - e.Position.Y));
                    rotate = (Math.Acos((a * a + b * b - c * c) / (2 * a * b))) / Math.PI * 180;

                    if (oldPoint.X > centerPoint.X)
                    {
                        if (oldPoint.Y < e.Position.Y)
                        {
                            compositTransform.Rotation = compositTransform.Rotation - rotate;
                        }
                        else
                        {
                            compositTransform.Rotation = compositTransform.Rotation + rotate;
                        }
                    }
                    else
                    {
                        if (oldPoint.Y > e.Position.Y)
                        {
                            compositTransform.Rotation = compositTransform.Rotation + rotate;
                        }
                        else
                        {
                            compositTransform.Rotation = compositTransform.Rotation - rotate;
                        }
                    }
                    if (compositTransform.Rotation < -270)
                    {
                        compositTransform.Rotation = -270;
                    }
                    else if (compositTransform.Rotation > 0)
                    {
                        compositTransform.Rotation = 0;
                    }
                    textCompositTransform.Rotation  = -compositTransform.Rotation;
                    gridCompositeTransform.Rotation = -compositTransform.Rotation;
                    TextVlaue  = (Convert.ToInt32(-compositTransform.Rotation / perValue)).ToString();
                    this.Value = Convert.ToInt32(-compositTransform.Rotation / perValue);
                    SetGradientStopOffset();
                }
                else
                {
                    e.Complete();
                }
            }
            catch { }
        }
Esempio n. 21
0
        public static void Motion(ManipulationDeltaRoutedEventArgs e)
        {
            figureTransform.TranslateX += e.Delta.Translation.X;
            figureTransform.TranslateY += e.Delta.Translation.Y;

            if (e.IsInertial)
            {
                e.Complete();
            }
        }
Esempio n. 22
0
 private void MapManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     if (mapCentered)
     {
         e.Complete();
     }
     else
     {
         map.TransformMap(e.Position, e.Delta.Translation, e.Delta.Rotation, e.Delta.Scale);
     }
 }
        private void LayoutRoot_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            if (e.IsInertial || ViewModel == null)
            {
                e.Complete();
                return;
            }

            var width  = (float)ActualWidth;
            var height = (float)ActualHeight;

            var offset = _layout.Offset;

            if (Math.Abs(e.Cumulative.Translation.X) > Math.Abs(e.Cumulative.Translation.Y))
            {
                var delta = (float)e.Delta.Translation.X;

                var current = -width;

                var maximum = current - width;
                var minimum = current + width;

                var index = ViewModel.SelectedIndex;
                if (index == 0)
                {
                    minimum = current;
                }
                if (index == ViewModel.Items.Count - 1)
                {
                    maximum = current;
                }

                offset.Y = 0;
                offset.X = Math.Max(maximum, Math.Min(minimum, offset.X + delta));

                _layer.Opacity = 1;
            }
            else
            {
                offset.X = -width;
                offset.Y = Math.Max(-height, Math.Min(height, offset.Y + (float)e.Delta.Translation.Y));

                var opacity = Math.Abs((offset.Y - -height) / height);
                if (opacity > 1)
                {
                    opacity = 2 - opacity;
                }

                _layer.Opacity = opacity;
            }

            _layout.Offset = offset;
            e.Handled      = true;
        }
Esempio n. 24
0
        /// <summary>
        /// Called before the ManipulationDelta event occurs.
        /// </summary>
        /// <param name="e">Event data for the event.</param>
        /// <remarks>
        /// This is used for touch scrolling.
        /// </remarks>
        protected override void OnManipulationDelta(ManipulationDeltaRoutedEventArgs e)
        {
            this.scroller += e.Delta.Translation.Y;
            e.Handled      = true;
            if (ProcessScroller() && e.IsInertial)
            {
                e.Complete();
            }

            base.OnManipulationDelta(e);
        }
Esempio n. 25
0
        private async void OnAdornManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            double delta = e.Delta.Translation.Y;

            await TranslateDelta(delta);

            if (_cancelManipulation)
            {
                e.Complete();
            }
        }
Esempio n. 26
0
        private void image_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            Image image = sender as Image;
            // Buscamos la posición de la imagen en la lista de imágenes, para poder saber cuál es su CompositeTransform
            int pos = listImages.IndexOf(listImages.Find(x => x == image));
            CompositeTransform ct = listCTransform[pos];

            // Rotation
            ct.Rotation += e.Delta.Rotation;
            // Scale
            ct.ScaleX /= e.Delta.Scale;
            ct.ScaleY /= e.Delta.Scale;
            // Translation
            ct.TranslateX += e.Delta.Translation.X;
            ct.TranslateY += e.Delta.Translation.Y;

            // Comprobamos que sea una pelota antes de contabilizar los goles
            if (isBall[pos] == true)
            {
                if (e.IsInertial)
                {
                    // Para detectar el gol encajado en la portería del equipo visitante
                    if (ct.TranslateY >= -70 && ct.TranslateY < 50 && ct.TranslateX > 770 && ct.TranslateX < 1000)
                    {
                        e.Complete();
                        local          = local + 1;
                        marcador1.Text = local.ToString();
                    }

                    // Para detectar el gol encajado en la portería del equipo local
                    if (ct.TranslateY >= -70 && ct.TranslateY < 50 && ct.TranslateX < -770 && ct.TranslateX >= -1000)
                    {
                        e.Complete();
                        visitante      = visitante + 1;
                        marcador2.Text = visitante.ToString();
                    }
                }
            }

            image.RenderTransform = ct;
        }
 private void DescGrid_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     if (e.IsInertial)
     {
         int threshold = 300;
         if (start.Y - e.Position.Y > threshold) //swipe left
         {
             e.Complete();
             DescGrid_DoubleTapped(null, null);
         }
     }
 }
Esempio n. 28
0
 void scrollViewer_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     if (e.IsInertial && isSwiping && !fullScreen)
     {
         Point currentpoint = e.Position;
         if (currentpoint.X - initialPoint.X >= 85)
         {
             isSwiping = false;
             var task = SwipeRight();
             initialPoint = currentpoint;
             e.Complete();
         }
         else if (initialPoint.X - currentpoint.X >= 85)
         {
             isSwiping = false;
             SwipeLeft();
             initialPoint = currentpoint;
             e.Complete();
         }
     }
 }
Esempio n. 29
0
 void ManipulateMe_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     if (forceManipulationsToEnd)
     {
         e.Complete();
         return;
     }
     //Set the new transform values based on user action
     previousTransform.Matrix      = transformGroup.Value;
     compositeTransform.TranslateX = e.Delta.Translation.X / scrollViewer.ZoomFactor;
     compositeTransform.TranslateY = e.Delta.Translation.Y / scrollViewer.ZoomFactor;
     e.Handled = true;
 }
Esempio n. 30
0
        private void OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            double deltaX = e.Delta.Translation.X;

            if (this.ActualWidth > this.ItemWidth * _panel.ItemsCount)
            {
                e.Complete();
                e.Handled = true;
                return;
            }

            if (this.Position + deltaX > this.ItemWidth / 2.5)
            {
                e.Complete();
                e.Handled = true;
                return;
            }

            if (this.Position + deltaX < -(this.ItemWidth * _panel.ItemsCount - this.ActualWidth) - this.ItemWidth / 2.5)
            {
                e.Complete();
                e.Handled = true;
                return;
            }

            int itemsPerThird = (int)Math.Ceiling(this.ActualWidth / this.ItemWidth);

            if (Math.Abs(e.Cumulative.Translation.X) >= this.ItemWidth * itemsPerThird)
            {
                e.Complete();
            }
            else
            {
                _panel.TranslateDeltaX(deltaX);
            }

            e.Handled = true;
        }