protected override void OnManipulationDelta(System.Windows.Input.ManipulationDeltaEventArgs e)
        {
            Rectangle rectToMove = e.OriginalSource as Rectangle;
            Matrix rectsMatrix = ((MatrixTransform)rectToMove.RenderTransform).Matrix;

            rectsMatrix.RotateAt(e.DeltaManipulation.Rotation,
                                 e.ManipulationOrigin.X,
                                 e.ManipulationOrigin.Y);

            rectsMatrix.ScaleAt(e.DeltaManipulation.Scale.X,
                                e.DeltaManipulation.Scale.X,
                                e.ManipulationOrigin.X,
                                e.ManipulationOrigin.Y);

            rectsMatrix.Translate(e.DeltaManipulation.Translation.X,
                                  e.DeltaManipulation.Translation.Y);

            rectToMove.RenderTransform = new MatrixTransform(rectsMatrix);

            Rect containingRect =
                new Rect(((FrameworkElement)e.ManipulationContainer).RenderSize);

            Rect shapeBounds =
                rectToMove.RenderTransform.TransformBounds(
                    new Rect(rectToMove.RenderSize));

            if (e.IsInertial && !containingRect.Contains(shapeBounds))
            {
                e.Complete();
            }

            e.Handled = true;
            //base.OnManipulationDelta(e);
        }
        private void reorderListBoxScriptBricks_ManipulationStarted(object sender, System.Windows.Input.ManipulationStartedEventArgs e)
        {
            object dragItem = ((ReorderListBox)sender).DragItem;

              if (dragItem is Script)
            e.Complete();
        }
        private void laptimeTextBox_ManipulationStarted(object sender, System.Windows.Input.ManipulationStartedEventArgs e)
        {
            NavigationService.Navigate(new Uri(string.Format("/LapTimeInputPage.xaml?time={0}", laptimeTextBox.Tag), UriKind.Relative));

            e.Complete();
            e.Handled = true;
        }
        private void sectorTextBox_ManipulationStarted(object sender, System.Windows.Input.ManipulationStartedEventArgs e)
        {
            var sectorNumber = 0;
            var sectorTime = 0;

            var sectorTextBox = sender as TextBox;
            if (sectorTextBox != null)
            {
                sectorNumber = sectorTextBox == sector1TextBox ? 1 : 2;
                sectorTime = (int)sectorTextBox.Tag;
            }
            NavigationService.Navigate(new Uri(string.Format("/SectorTimeInputPage.xaml?sector={0}&time={1}", sectorNumber, sectorTime), UriKind.Relative));

            e.Complete();
            e.Handled = true;
        }
Example #5
0
 private void LayoutRoot_ManipulationDelta(object sender, System.Windows.Input.ManipulationDeltaEventArgs e)
 {
     if (e.IsInertial)
     {
         e.Complete();
         return;
     }
 }
 private void StackPanel_ManipulationDelta(object sender, System.Windows.Input.ManipulationDeltaEventArgs e)
 {
     x2 = e.ManipulationOrigin.X;
     y2 = e.ManipulationOrigin.Y;
     if (Math.Max(y2, y) - Math.Min(y2, y) > ((Math.Max(x2, x) - Math.Min(x2, x)) * 2) && scrolLock == false)
     {
         scrolLock = false;
     }
     if ((x2 - x) > ((Math.Max(y2, y) - Math.Min(y2, y)) * 2) && scrolLock == false)
     {
         scrolLock = true;
     }
     if ((x2 - x) < 0)
     {
         scrolLock = false;
         TranslateTransform tr = new TranslateTransform();
         tr.X = 0;
         StackPanel st = (StackPanel)sender;
         st.RenderTransform = tr;
         e.Complete();
     }
     if (scrolLock == true)
     {
         TranslateTransform tr = new TranslateTransform();
         tr.X = x2 - x;
         StackPanel st = (StackPanel)sender;
         st.RenderTransform = tr;
     }
 }
        private void touchBorder_ManipulationDelta(object sender, System.Windows.Input.ManipulationDeltaEventArgs e)
        {
            // is zoom
            if (e.DeltaManipulation.Scale.X != 0 ||
                e.DeltaManipulation.Scale.Y != 0)
            {
                this.RoutesLayer.Children.Clear();
                e.Complete();
                var zoom = this.OSM_Map.ZoomLevel * Math.Min(e.DeltaManipulation.Scale.X,
                                                             e.DeltaManipulation.Scale.Y);
                if (zoom == this.OSM_Map.ZoomLevel)
                    zoom = this.OSM_Map.ZoomLevel * Math.Max(e.DeltaManipulation.Scale.X,
                                                             e.DeltaManipulation.Scale.Y);
                if (zoom == this.OSM_Map.ZoomLevel)
                    return;

                this.OSM_Map.ZoomLevel = zoom;
                this.OSM_Map.Center = this.OSM_Map.ViewportPointToLocation(e.ManipulationOrigin);
            }
            else // no zoom
            {
                var newpos = this.OSM_Map.LocationToViewportPoint(this.OSM_Map.Center);
                var widthConst = 1;
                var heightConst = 1;
                var dx = e.DeltaManipulation.Translation.X * widthConst;
                var dy = e.DeltaManipulation.Translation.Y * heightConst;
                newpos.X -= dx;
                newpos.Y -= dy;
                this.OSM_Map.AnimationLevel = AnimationLevel.None;
                this.OSM_Map.Center = this.OSM_Map.ViewportPointToLocation(newpos);
                this.OSM_Map.AnimationLevel = AnimationLevel.Full;
            }
            e.Handled = true;
        }
        private void DragBorder_ManipulationStarted(object sender, System.Windows.Input.ManipulationStartedEventArgs e)
        {
            //if we are already activated, do not process further interaction
            if (IsActivated)
            {
                _ignoreManipulationCompleted = true;
                e.Complete();
                return;
            }

            HandleUserInteractionStarted();
        }