Example #1
0
        private async void ScrollViewer_OnDoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            if (e.PointerDeviceType != Windows.Devices.Input.PointerDeviceType.Mouse)
            {
                await Task.Delay(100);
            }
            var scrollViewer = sender as ScrollViewer;

            if (scrollViewer == null)
            {
                return;
            }

            var doubleTapPoint = e.GetPosition(scrollViewer);

            if (scrollViewer.ZoomFactor != 1.0)
            {
                scrollViewer.ChangeView(null, null, 1);
            }
            else
            {
                scrollViewer.ChangeView(doubleTapPoint.X, doubleTapPoint.Y, 2);
            }
            e.Handled = true;
        }
Example #2
0
 private void image_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
 {
     //Get the precise pointer position at the time of doubletap in order to center the view at that location
     p = e.GetPosition(sender as Image);
     //set the internal flag to track the doubletapped gesture
     isDoubleTapped = true;
 }
Example #3
0
        private void ItemDoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            var target   = (FrameworkElement)sender;
            var position = e.GetPosition(target).LogicalToPhysicalPixels();

            LastDoubleTapped.Text = $"Item_{target.DataContext}@{position.X:F2},{position.Y:F2}";
        }
Example #4
0
        /// <summary>
        /// Executes the <see cref="DoubleTapAction"/> associated with the behavior.
        /// </summary>
        /// <param name="args">The <see cref="Windows.UI.Xaml.Input.DoubleTappedRoutedEventArgs"/> instance containing the event data.</param>
        protected internal override void OnDoubleTapped(DoubleTappedRoutedEventArgs args)
        {
            base.OnDoubleTapped(args);

            if (args == null)
            {
                return;
            }

            if (this.DoubleTapAction == MapDoubleTapAction.ZoomToPoint)
            {
                double newZoomLevel = this.ClampZoomLevel(map.ZoomLevel + DoubleTapZoomAmount);
                if (this.map.ZoomLevel == newZoomLevel)
                {
                    return;
                }

                this.ZoomToPoint(args.GetPosition(this.map), newZoomLevel);
            }
            else if (this.DoubleTapAction == MapDoubleTapAction.Reset)
            {
                this.map.ClearValue(RadMap.ZoomLevelProperty);
                this.map.ClearValue(RadMap.CenterProperty);
            }
        }
        void OnDoubleTap(object sender, DoubleTappedRoutedEventArgs e)
        {
            var view = Element as View;

            if (view == null)
            {
                return;
            }

            var tapPosition = e.GetPosition(Control);
            var children    = (view as IGestureController)?.GetChildElements(new Point(tapPosition.X, tapPosition.Y));

            if (children != null)
            {
                foreach (var recognizer in children.GetChildGesturesFor <TapGestureRecognizer>(g => g.NumberOfTapsRequired == 1 || g.NumberOfTapsRequired == 2))
                {
                    recognizer.SendTapped(view);
                    e.Handled = true;
                }
            }

            if (e.Handled)
            {
                return;
            }

            IEnumerable <TapGestureRecognizer> doubleTapGestures = view.GestureRecognizers.GetGesturesFor <TapGestureRecognizer>(g => g.NumberOfTapsRequired == 1 || g.NumberOfTapsRequired == 2);

            foreach (TapGestureRecognizer recognizer in doubleTapGestures)
            {
                recognizer.SendTapped(view);
                e.Handled = true;
            }
        }
        private async void ImageDoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            var sv = sender as ScrollViewer;

            if (sv == null)
            {
                return;
            }
            Point p = e.GetPosition(sv);

            TimeSpan period = TimeSpan.FromMilliseconds(10);

            Windows.System.Threading.ThreadPoolTimer.CreateTimer(async(source) =>
            {
                await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    if (sv.ZoomFactor <= 1)
                    {
                        //var k = sv.ChangeView(p.X + sv.HorizontalOffset * 2, p.Y + sv.VerticalOffset * 2, 2);
                        var k = sv.ChangeView(50, 50, 2);
                    }
                    else
                    {
                        sv.ChangeView(sv.HorizontalOffset / 2 - p.X, sv.VerticalOffset / 2 - p.Y, 1);
                    }
                });
            }
                                                                 , period);
        }
Example #7
0
        private async void ScrollViewerDoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            try
            {
                var scrollViewer   = sender as ScrollViewer;
                var doubleTapPoint = e.GetPosition(scrollViewer);

#pragma warning disable CS0618 // Type or member is obsolete
                if (scrollViewer.ZoomFactor != 1)
                {
                    scrollViewer.ZoomToFactor(1);
                }
                else if (scrollViewer.ZoomFactor == 1)
                {
                    scrollViewer.ZoomToFactor(2);

                    var dispatcher = Window.Current.CoreWindow.Dispatcher;
                    await dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
                    {
                        scrollViewer.ScrollToHorizontalOffset(doubleTapPoint.X);
                        scrollViewer.ScrollToVerticalOffset(doubleTapPoint.Y);
                    });
                }
#pragma warning restore CS0618 // Type or member is obsolete
            }
            catch { }
        }
        protected override void OnDoubleTapped(DoubleTappedRoutedEventArgs e)
        {
            if (!this.TreeGrid.ValidationHelper.CheckForValidation(false))
            {
                return;
            }
            if (Column.AllowSorting &&
                this.TreeGrid.SortClickAction == SortClickAction.DoubleClick)
            {
                this.TreeGrid.TreeGridModel.MakeSort(Column);
            }
            Point pp       = e.GetPosition(this.TreeGrid.TreeGridPanel);
            var   cursor   = CoreCursorType.Arrow;
            var   dragline = this.TreeGrid.ColumnResizingController.HitTest(pp, out cursor);

            if (cursor != CoreCursorType.Arrow)
            {
                this.TreeGrid.ColumnResizingController.SetPointerCursor(cursor);
            }
            if (Window.Current.CoreWindow.PointerPosition.X > 0 && Window.Current.CoreWindow.PointerPosition.Y > 0)
            {
                if (this.Column.AllowResizing && Window.Current.CoreWindow.PointerCursor.Type != CoreCursorType.Arrow && dragline != null)
                {
                    SetAutoWidth(dragline.LineIndex);
                }
                else
                {
                    Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Arrow, 1);
                }
            }
            base.OnDoubleTapped(e);
        }
Example #9
0
        private void OnDoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            // We have a new interaction with the screen, so stop all navigator animations
            Navigator.StopRunningAnimation();

            var tapPosition = e.GetPosition(this).ToMapsui();

            OnInfo(InvokeInfo(tapPosition, tapPosition, 2));
        }
Example #10
0
        //DoubleTappedRoutedEventArgs
        public UwpTapEventArgs(FrameworkElement element, DoubleTappedRoutedEventArgs args, int numberOfTaps)
        {
            ElementPosition = element.GetXfViewFrame();
            var point = args.GetPosition(element);

            ElementTouches = new Xamarin.Forms.Point[] { point.ToXfPoint() };
            WindowTouches  = new Xamarin.Forms.Point[] { element.PointInNativeAppWindowCoord(point).ToXfPoint() };
            NumberOfTaps   = numberOfTaps;
        }
Example #11
0
        private void Grid_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            //Creates an Inertial Ball
            //Inertial ball is an object that contains an Image, with several attributes
            //Inertial ball object can be found in /Objects/InertialImage.cs
            var inertialImage = new InertialImage();
            var image         = inertialImage.GetImage();

            image.ManipulationStarted   += Image_ManipulationStarted;
            image.ManipulationDelta     += Image_ManipulationDelta;
            image.ManipulationCompleted += Image_ManipulationCompleted;
            grid.Children.Add(image);
            var compositeTransform = image.RenderTransform as CompositeTransform;

            compositeTransform.TranslateX = e.GetPosition(grid).X - grid.ActualWidth / 2;
            compositeTransform.TranslateY = e.GetPosition(grid).Y - grid.ActualHeight / 2;
            images.Add(inertialImage);
        }
        internal void OnCellsPanelDoubleTapped(DoubleTappedRoutedEventArgs e)
        {
            var cell = this.hitTestService.GetCellFromPoint(e.GetPosition(this.cellsPanel).ToRadPoint());

            if (cell != null)
            {
                this.commandService.ExecuteCommand(CommandId.CellDoubleTap, new DataGridCellInfo(cell));
            }
        }
Example #13
0
        private void InkCanvas_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            var position = e.GetPosition(_inkCanvas);

            if (selectedNode != null && RectHelper.Contains(selectedNode.BoundingRect, position))
            {
                ExpandSelection();
                lastDoubleTapTime = DateTime.Now;
            }
        }
Example #14
0
 private void MVControl_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
 {
     if (MVControl.ActualHeight - e.GetPosition(MVControl).Y > 100)
     {
         if (MusicCover.Visibility != Visibility.Visible)
         {
             MVControl.IsFullWindow = !MVControl.IsFullWindow;
         }
     }
 }
Example #15
0
        private void Grid_DoubleTapped_1(object sender, DoubleTappedRoutedEventArgs e)
        {
            var pos = e.GetPosition(this);

            AddWithFocus(string.Format("{0}:{1} Double Tap", (int)pos.X, (int)pos.Y));
            Transformation.ScaleX     = 1.0;
            Transformation.ScaleY     = 1.0;
            Transformation.TranslateX = 0;
            Transformation.TranslateY = 0;
            Transformation.Rotation   = 0;
        }
        private void Border_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            double thumbPosition = e.GetPosition(ContainerCanvas).X;
            double itemPostion   = thumbPosition / (ContainerCanvas.ActualWidth - THUMB_WIDTH);

            // Add new color to collection
            ColorItem colorItem = new ColorItem {
                Color = Windows.UI.Colors.White, Offset = itemPostion
            };

            colorCollectionItem.Colors.Add(colorItem);
            SetSelectedThumb(colorItem);
        }
Example #17
0
        private void grid_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            double x = e.GetPosition(innerGrid).X;
            double y = e.GetPosition(innerGrid).Y;

            Image ball = new Image();

            ball.Width  = 70;
            ball.Height = 70;
            compositeTransform.TranslateX = x - grid.ActualWidth / 2;
            compositeTransform.TranslateY = y - grid.ActualHeight / 2;
            ball.RenderTransform          = compositeTransform;
            BitmapImage bitmapImage = new BitmapImage(new Uri("ms-appx:///Assets/ball.png"));

            ball.Source = bitmapImage;

            ball.ManipulationMode   = ManipulationModes.All;
            ball.ManipulationDelta += Image_ManipulationDelta;

            balls.Add(ball);
            innerGrid.Children.Add(ball);
        }
Example #18
0
        private async void EventList_DoubleTapped_1(object sender, DoubleTappedRoutedEventArgs e)
        {
            _events.Add("Context Menu invoked.");
            var contextMenu = new PopupMenu();

            contextMenu.Commands.Add(new UICommand("Clear list",
                                                   args => _events.Clear()));
            var dismissed = await contextMenu.ShowAsync(
                e.GetPosition(EventList));

            _events.Add(string.Format("Context Menu dismissed: {0}",
                                      dismissed == null ? "Canceled" : dismissed.Label));
        }
Example #19
0
 private void MapOnDoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
 {
     if ((_map != null) && DoubleTapEnabled)
     {
         Point  position  = e.GetPosition(_map);
         double zoomDelta = DoubleTapDelta;
         if (ShiftInvertsDoubleTap && (Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift) == CoreVirtualKeyStates.Down))
         {
             zoomDelta = -zoomDelta;
         }
         UpdateZoomOnlyManipulation(zoomDelta, position);
         e.Handled = true;
     }
 }
Example #20
0
        protected override void OnDoubleTapped(DoubleTappedRoutedEventArgs e)
        {
            WithRenderer(r =>
            {
                var position = e.GetPosition(canvasControl).ToVector2();

                var hitResult = r.Scene.HitTest(position);

                if (hitResult != null)
                {
                    textEditor.BeginEdit(hitResult.RenderNode);
                    textEditor.Transform();
                }
            });
        }
Example #21
0
        private async void ScrollViewer_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            await Task.Delay(1);

            var scrollViewer   = sender as ScrollViewer;
            var doubleTapPoint = e.GetPosition(scrollViewer);

            if (scrollViewer.ZoomFactor != 1)
            {
                scrollViewer.ChangeView(doubleTapPoint.X, doubleTapPoint.Y, 1, false);
            }
            else if (scrollViewer.ZoomFactor == 1)
            {
                scrollViewer.ChangeView(doubleTapPoint.X, doubleTapPoint.Y, 2, false);
            }
        }
Example #22
0
        private void HandleDoubleTapped(Object sender, DoubleTappedRoutedEventArgs args)
        {
            // Check to see if this kind of device is being ignored
            if (!IsValidDevice(args.PointerDeviceType))
            {
                return;
            }

            // Examine the current position
            var position = args.GetPosition(_eventSourceElement);

            System.Diagnostics.Debug.WriteLine("DoubleTapped at X={0}, Y={1}", position.X, position.Y);

            // Alter the shape based on the gesture performed
            _shapeModel.SetRandomDirection();
        }
        private void DartboardOnDoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            var boardPartClicked = e.OriginalSource as Path;

            if (Enabled && boardPartClicked != null)
            {
                var score = new Score {
                    Position = e.GetPosition(this)
                };
                SetDart(score.Position);

                ClickBoardHelper(boardPartClicked, score);

                DartScore = score;
            }
        }
Example #24
0
        private void drawingCanvas_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            Point  mouseLocation = e.GetPosition(this.drawingCanvas);
            Square mySquare      = new Square(100);

            if (mySquare is IDraw)
            {
                IDraw drawSquare = mySquare;
                drawSquare.SetLocation((int)mouseLocation.X, (int)mouseLocation.Y);
                drawSquare.Draw(drawingCanvas);
            }
            if (mySquare is IColor)
            {
                IColor colorSquare = mySquare;
                colorSquare.SetColor(Colors.BlueViolet);
            }
        }
Example #25
0
        private async void PanelDoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            var position = e.GetPosition(Panel);

            if (ScrollingHost.ZoomFactor != 1)
            {
                ScrollingHost.ChangeView(null, null, 1, true);
            }
            else if (ScrollingHost.ZoomFactor == 1)
            {
                var dispatcher = Window.Current.CoreWindow.Dispatcher;
                await dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
                {
                    ScrollingHost.ChangeView(position.X, position.Y, 4, true);
                });
            }
        }
Example #26
0
 //Zoom in and out
 private void scrollviewer_ImageViewer_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
 {
     try
     {
         AppVariables.SingleTappedEvent = false;
         if (scrollviewer_ImageViewer.ZoomFactor == 1.0f)
         {
             System.Diagnostics.Debug.WriteLine("Zooming the scrollviewer");
             Point currentPoint = e.GetPosition(scrollviewer_ImageViewer);
             scrollviewer_ImageViewer.ChangeView((currentPoint.X * 0.5), null, 1.5f, true);
         }
         else
         {
             System.Diagnostics.Debug.WriteLine("Resetting the scrollviewer");
             scrollviewer_ImageViewer.ChangeView(null, null, 1.0f, true);
         }
     }
     catch { }
 }
Example #27
0
        private async void scrollViewer_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            var scrollViewer   = sender as ScrollViewer;
            var doubleTapPoint = e.GetPosition(scrollViewer);

            if (scrollViewer.ZoomFactor != 1)
            {
                scrollViewer.ZoomToFactor(1);
            }
            else if (scrollViewer.ZoomFactor == 1)
            {
                scrollViewer.ZoomToFactor(2);
                var dispatcher = Window.Current.CoreWindow.Dispatcher;
                await dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
                {
                    scrollViewer.ScrollToHorizontalOffset(doubleTapPoint.X);
                    scrollViewer.ScrollToVerticalOffset(doubleTapPoint.Y);
                });
            }
        }
Example #28
0
        private void ScrollRoot_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            var   scrollRoot = (ScrollViewer)sender;
            Point position   = e.GetPosition((UIElement)scrollRoot.Content);

            ThreadPoolTimer.CreateTimer(async args => await Dispatcher.RunAsync(
                                            CoreDispatcherPriority.Normal,
                                            () =>
            {
                if (scrollRoot.ZoomFactor > 1)
                {
                    scrollRoot.ChangeView(0, 0, null, false);
                    scrollRoot.ChangeView(null, null, scrollRoot.MinZoomFactor, false);
                }
                else
                {
                    scrollRoot.ChangeView(position.X, position.Y, 2, false);
                }
            }), TimeSpan.FromMilliseconds(100));
        }
Example #29
0
        private void Grid_OnDoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            e.Handled = true;
            var point = e.GetPosition(this.ContentGrid);

            if (this.ColorPanel.Visibility == Visibility.Visible)
            {
                MenuOpiton(false);
                return;
            }
            //上一章
            if (point.X > this.ContentGrid.ActualWidth / 3 && point.X < this.ContentGrid.ActualWidth / 3 * 2)
            {
                MenuOpiton(true);
            }
            else
            {
                OnTapped(point);
            }
        }
        // double tap to zoom
        private async void ScrollViewer_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            var scrollViewer = sender as ScrollViewer;

            var dispatcher = Window.Current.CoreWindow.Dispatcher;
            await dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () =>
            {
                var doubleTapPoint = e.GetPosition(scrollViewer);

                if (scrollViewer.ZoomFactor > 1)
                {
                    scrollViewer.ChangeView(0, 0, 1.0F);
                }
                else
                {
                    //Debug.WriteLine(doubleTapPoint.X + "x" + doubleTapPoint.Y);
                    scrollViewer.ChangeView(doubleTapPoint.X, doubleTapPoint.Y, 2.0F);
                    scrollViewer.ChangeView(doubleTapPoint.X, doubleTapPoint.Y, 2.0F);
                }
            });
        }