GetCurrentPoint() public method

public GetCurrentPoint ( [ relativeTo ) : PointerPoint
relativeTo [
return Windows.UI.Input.PointerPoint
示例#1
0
        public void Zoom(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            var mousePoint = e.GetCurrentPoint(null).Position;
            var wheel      = e.GetCurrentPoint(null).Properties.MouseWheelDelta / 120;
            var zoom       = Math.Exp(wheel * ZoomIntensity);

            _zoom(zoom, mousePoint.X, mousePoint.Y);
        }
 private void xThumbVolumeRectangle_PointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
 {
     e.Handled = true;
     xThumbVolumeRectangle.CapturePointer(e.Pointer);
     _orientalVolumePosition      = e.GetCurrentPoint(xVolumeSliderGrid).Position;
     _orientalThumbVolumePosition = e.GetCurrentPoint(xThumbVolumeRectangle).Position.X;
     _isDraggingOfVolume          = true;
 }
示例#3
0
 private void OnLayoutRootPointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
 {
     if (e.Pointer.PointerDeviceType == PointerDeviceType.Mouse)
     {
         _rightMouseButtonPressed =
             e.GetCurrentPoint((UIElement)sender).Properties.IsRightButtonPressed&&
             !e.GetCurrentPoint((UIElement)sender).Properties.IsLeftButtonPressed&&
             !e.GetCurrentPoint((UIElement)sender).Properties.IsMiddleButtonPressed;
     }
 }
示例#4
0
        private void MainScrollviewer_PointerMoved(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            var scrollViewer = sender as ScrollViewer;

            if (scrollViewer.PointerCaptures != null && scrollViewer.PointerCaptures.Count > 0)
            {
                scrollViewer.ChangeView(hOff + (scrollMousePoint.Position.X - e.GetCurrentPoint(scrollViewer).Position.X),
                                        vOff + (scrollMousePoint.Position.Y - e.GetCurrentPoint(scrollViewer).Position.Y), null);
            }
        }
示例#5
0
        private void OnLayoutRootPointerReleased(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            if (e.Pointer.PointerDeviceType == PointerDeviceType.Mouse &&
                !e.GetCurrentPoint((UIElement)sender).Properties.IsLeftButtonPressed&&
                !e.GetCurrentPoint((UIElement)sender).Properties.IsMiddleButtonPressed&&
                _rightMouseButtonPressed)
            {
                OnSwitchGesture();
            }

            _rightMouseButtonPressed = false;
        }
示例#6
0
        void ll_PointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            if (!_IsEnableLeft)
            {
                return;
            }
            BeginDrag = true;
            Panel p = (Panel)uc.Parent;

            R  = Canvas.GetLeft(uc) + uc.ActualWidth;
            x0 = e.GetCurrentPoint(null).Position.X;
            y0 = e.GetCurrentPoint(null).Position.Y;
        }
        private void xVolumeTotalCanvas_PointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            e.Handled = true;
            _currentVolumePosition = e.GetCurrentPoint(xVolumeSliderGrid).Position.X - _thumbVolumeWidth / 2;
            SetVolumeSliderPosition();
            double value = (e.GetCurrentPoint(xVolumeSliderGrid).Position.X - _orientalThumbVolumePosition) / (350 - _thumbVolumeWidth);

            if (VolumeChanged != null)
            {
                VolumeChanged(sender, value);
            }
            SetVolumeState(value);
        }
示例#8
0
		private void Canvas_OnPointerReleased(object sender, PointerRoutedEventArgs e)
		{
			var ptrId = e.GetCurrentPoint(sender as FrameworkElement).PointerId;
			if (e.GetCurrentPoint((Canvas)sender).Properties.PointerUpdateKind != PointerUpdateKind.Other)
			{
				ButtonPressTextBlock.Text = e.GetCurrentPoint((Canvas)sender).Properties.PointerUpdateKind.ToString();
			}
			if (_contacts.ContainsKey(ptrId))
			{
				_contacts[ptrId] = null;
				_contacts.Remove(ptrId);
			}
			e.Handled = true;
		}
 void Scenario1OutputRoot_PointerReleased(object sender, PointerRoutedEventArgs e)
 {
     uint ptrId = e.GetCurrentPoint(sender as FrameworkElement).PointerId;
     if (e.GetCurrentPoint(Scenario1OutputRoot).Properties.PointerUpdateKind != Windows.UI.Input.PointerUpdateKind.Other)
     {
         this.buttonPress.Text = e.GetCurrentPoint(Scenario1OutputRoot).Properties.PointerUpdateKind.ToString();
     }
     if (contacts.ContainsKey(ptrId))
     {
         contacts[ptrId] = null;
         contacts.Remove(ptrId);
         --numActiveContacts;
     }
     e.Handled = true;
 }
示例#10
0
        protected virtual void uiElement_PointerMoved(object sender, PointerRoutedEventArgs e)
        {
            if (moveD3dCanvas)
            {
                var newPosition = e.GetCurrentPoint(null);
                double deltaX = newPosition.Position.X - lastPos.Position.X;
                double deltaY = newPosition.Position.Y - lastPos.Position.Y;

                // Only support CompositeTransform and TranslateTransform
                // Is there any better way to handle this?
                if (uiElement.RenderTransform is CompositeTransform)
                {
                    var compositeTransform = (CompositeTransform)uiElement.RenderTransform;
                    compositeTransform.TranslateX += deltaX;
                    compositeTransform.TranslateY += deltaY;
                }
                else if (uiElement.RenderTransform is TranslateTransform)
                {
                    var translateTransform = (TranslateTransform)uiElement.RenderTransform;
                    translateTransform.X += deltaX;
                    translateTransform.Y += deltaY;
                }

                lastPos = newPosition;
            }
        }
示例#11
0
        private void MyCanvas_PointerMoved(object sender, PointerRoutedEventArgs e)
        {
            PointerPoint point = e.GetCurrentPoint(this);
            // move paddle... x
            game.paddle.Move(point.Position.X);

        }
 private void xThumbRectangle_PointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
 {
     e.Handled = true;
     if (!_isEnable)
     {
         return;
     }
     if (Seeking != null)
     {
         Seeking(sender);
     }
     xThumbRectangle.CapturePointer(e.Pointer);
     _orientalPosition      = e.GetCurrentPoint(xSliderGrid).Position;
     _orientalThumbPosition = e.GetCurrentPoint(xThumbRectangle).Position.X;
     _isDragging            = true;
 }
        void xamDataChart_PointerMoved(object sender, PointerRoutedEventArgs e,
            Infragistics.Controls.Charts.XamDataChart targetChart)
        {
            XamDataChart chart = sender as XamDataChart;
            if (chart == null)
            {
                return;
            }
            //System.Diagnostics.Debug.WriteLine(targetChart.GetHashCode().ToString() + " PointerMoved: " + e.GetCurrentPoint(null).Position.ToString());

            chart = targetChart;
            foreach (var series in chart.Series)
            {
                var seriesPos = e.GetCurrentPoint(series).Position;
                //System.Diagnostics.Debug.WriteLine("TrySelectClosest: " + seriesPos.ToString());
                if (seriesPos.X >= 0 &&
                    seriesPos.X < series.ActualWidth &&
                    (sender != targetChart || (seriesPos.Y >= 0 && seriesPos.Y < series.ActualHeight)))
                {
                    SelectClosest(
                    series, seriesPos);
                }
            }

            if (sender == targetChart)
                CategoryChart_PointerMoved(sender, e, targetChart);

            if (sender == targetChart)
            {
                this.NotifyOtherTracker(sender, e);
            }
        }
		// HitTest the graphics and position the map tip
		private async void MyMapView_PointerMoved(object sender, PointerRoutedEventArgs e)
		{
			if (!_isMapReady)
				return;

			try
			{
				_isMapReady = false;

				Point screenPoint = e.GetCurrentPoint(MyMapView).Position;
				var graphic = await _graphicsLayer.HitTestAsync(MyMapView, screenPoint);
				if (graphic != null)
				{
					_mapTip.DataContext = graphic;
					_mapTip.Visibility = Visibility.Visible;
				}
				else
					_mapTip.Visibility = Visibility.Collapsed;
			}
			catch
			{
				_mapTip.Visibility = Visibility.Collapsed;
			}
			finally
			{
				_isMapReady = true;
			}
		}
示例#15
0
        private void _flexChart_PointerReleased(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            if (e.Pointer.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Mouse)
            {
                _drawing = false;

                var p = e.GetCurrentPoint((UIElement)sender);
                if (p.Properties.IsLeftButtonPressed)
                {
                    if (AllowAdd)
                    {
                        _start = _end = new Point();
                    }
                    if (_isDragging)
                    {
                        UpdateRectCache(SelectedAnnotation);
                        _isDragging = false;
                        Windows.UI.Xaml.Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Arrow, 1);
                    }
                }


                foreach (var anno in _rectCache)
                {
                    UpdateRectCache(anno.annotation);
                }
                _flexChart.Invalidate();
            }
        }
示例#16
0
        private async void Control_PointerWheelChanged(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            //Debug.WriteLine("Control_PointerWheelChanged");
            var pointer = e.GetCurrentPoint(Control).Properties;

            if (!pointer.IsLeftButtonPressed && !pointer.IsRightButtonPressed)
            {
                double oldScale = Element.ViewScale;
                int    delta    = pointer.MouseWheelDelta;
                if (delta > 0)
                {
                    Element.ViewScale = Element.ViewScale * (0.2 * delta / 120 + 1);
                }
                else if (delta < 0)
                {
                    Element.ViewScale = Element.ViewScale / (0.2 * -delta / 120 + 1);
                }

                Point oldPoint = Element.ViewPoint.Offset(pointer.ContactRect.X / oldScale, pointer.ContactRect.Y / oldScale);
                Point newPoint = Element.ViewPoint.Offset(pointer.ContactRect.X / Element.ViewScale, pointer.ContactRect.Y / Element.ViewScale);
                Element.ViewPoint = Element.ViewPoint.Offset(oldPoint.X - newPoint.X, oldPoint.Y - newPoint.Y);

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

                Control.Invalidate();
            }
        }
示例#17
0
		private void Canvas_OnPointerMoved(object sender, PointerRoutedEventArgs e)
		{
			var pt = e.GetCurrentPoint((Canvas)sender);
			var ptrId = pt.PointerId;
			if (pt.Properties.PointerUpdateKind != PointerUpdateKind.Other)
			{
				ButtonPressTextBlock.Text = pt.Properties.PointerUpdateKind.ToString();
			}

			if (_contacts.ContainsKey(ptrId) && _contacts[ptrId].HasValue)
			{
				var currentContact = pt.Position;
				var previousContact = _contacts[ptrId].Value;
				if (Distance(currentContact, previousContact) > 4)
				{
					var l = new Line
					{
						X1 = previousContact.X,
						Y1 = previousContact.Y,
						X2 = currentContact.X,
						Y2 = currentContact.Y,
						StrokeThickness = STROKETHICKNESS,
						Stroke = new SolidColorBrush(Colors.Red),
						StrokeEndLineCap = PenLineCap.Round
					};

					_contacts[ptrId] = currentContact;
					((Canvas)sender).Children.Add(l);
				}
			}

			e.Handled = true;
		}
示例#18
0
        private void pointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            Windows.UI.Xaml.Input.Pointer ptr = e.Pointer;
            PointerPoint ptrPt     = e.GetCurrentPoint(img);
            uint         pointerId = ptrPt.PointerId;

            textbox1.Text += "P id:" + ptrPt.PointerId + "\tX:\t" + ptrPt.Position.X + "\tY:\t" + ptrPt.Position.Y + "\n";

            int   frecuencia = (int)(ptrPt.Position.X * 2048.0f / 640.0f);
            float vol        = (float)(ptrPt.Position.Y / 1280.0f);

            if (!dictSonidos.ContainsKey(ptrPt.PointerId))
            {
                dictSonidos.Add(ptrPt.PointerId, new sonido(vol, frecuencia, ptrPt.PointerId, xaudio2, syntActual, envoActual, envolventeFreq));

                dictSonidos[pointerId].play();
            }
            else
            {
                //dictSonidos[ptrPt.PointerId]= new sonido(vol,frecuencia, ptrPt.PointerId, xaudio2);
                dictSonidos[pointerId].play();
            }

            e.Handled = true;
        }
		private async void MyMapView_PointerMoved(object sender, PointerRoutedEventArgs e)
		{
			if (!_isMapReady)
				return;

			try
			{
				_isMapReady = false;

				Point screenPoint = e.GetCurrentPoint(MyMapView).Position;
				var rows = await _featureLayer.HitTestAsync(MyMapView, screenPoint);
				if (rows != null && rows.Length > 0)
				{
					var features = await _featureLayer.FeatureTable.QueryAsync(rows);
					_mapTip.DataContext = features.FirstOrDefault();
					_mapTip.Visibility = Visibility.Visible;
				}
				else
					_mapTip.Visibility = Visibility.Collapsed;
			}
			catch
			{
				_mapTip.Visibility = Visibility.Collapsed;
			}
			finally
			{
				_isMapReady = true;
			}
		}
        private async void OnCanvasPointerMoved(object sender, PointerRoutedEventArgs e)
        {
            if (e.Pointer.PointerId != _mPenId) return;
            PointerPoint pt = e.GetCurrentPoint(InkCanvas);
            _currentContactPt = pt.Position;
            _x1 = Convert.ToInt32(_previousContactPt.X);
            _y1 = Convert.ToInt32(_previousContactPt.Y);
            _x2 = Convert.ToInt32(_currentContactPt.X);
            _y2 = Convert.ToInt32(_currentContactPt.Y);

            Color color = _mCurrentDrawingColor;
            const double size = MCurrentDrawingSize;

            if (Distance(_x1, _y1, _x2, _y2) > 2.0)
            {
                var line = new Line
                {
                    X1 = _x1,
                    Y1 = _y1,
                    X2 = _x2,
                    Y2 = _y2,
                    StrokeThickness = size,
                    Stroke = new SolidColorBrush(color)
                };

                _previousContactPt = _currentContactPt;

                InkCanvas.Children.Add(line);

                // Send a message to the server
                await _draw.Invoke("BroadcastPoint", _x2, _y2);
            }

            CurrentManager.ProcessPointerUpdate(pt);
        }
示例#21
0
        void scrollableContent_PointerReleased(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            if (!this.IsPullToRefreshEnabled)
            {
                return;
            }

            if (capturedPointer != null)
            {
                this.scrollableContent.ReleasePointerCaptures();
                capturedPointer = null;
            }
            var offsetPoint   = e.GetCurrentPoint(this.scrollableContent).Position;
            var offset        = this.virtualizationStrategy.LayoutOrientation == Orientation.Vertical ? offsetPoint.Y : offsetPoint.X;
            var startLocation = this.virtualizationStrategy.LayoutOrientation == Orientation.Vertical ? startPoint.Y : startPoint.X;

            if (offset - startLocation > PullToRefreshScrollOffsetThreshold)
            {
                this.OnRefreshRequested();
                this.TranslateItemsPanel(PullToRefreshScrollOffsetThreshold);
            }

            pointerPressed    = false;
            startScrollOffset = -1;

            if (!refreshRequested)
            {
                this.TranslateItemsPanel(0);
            }
        }
示例#22
0
        void scrollViewerPresenter_PointerMoved(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            if (!this.IsPullToRefreshEnabled)
            {
                return;
            }

            if (!this.refreshRequested && startScrollOffset == 0 && pointerPressed)
            {
                var offsetPoint   = e.GetCurrentPoint(this.scrollableContent).Position;
                var offset        = this.virtualizationStrategy.LayoutOrientation == Orientation.Vertical ? offsetPoint.Y : offsetPoint.X;
                var startLocation = this.virtualizationStrategy.LayoutOrientation == Orientation.Vertical ? startPoint.Y : startPoint.X;

                this.scrollableContent.CancelDirectManipulations();

                if (capturedPointer == null)
                {
                    capturedPointer = e.Pointer;
                    this.scrollableContent.CapturePointer(capturedPointer);
                }
                this.virtualizationStrategy.SetElementCanvasOffset(this.itemsPanel, offset - startLocation);

                if (offset - startLocation > PullToRefreshScrollOffsetThreshold)
                {
                    this.OnReleseRequested();
                }
                else
                {
                    this.pullToRefreshIndicator.StopLoading();
                }
            }
        }
        // HitTest the graphics and position the map tip
        private async void mapView_PointerMoved(object sender, PointerRoutedEventArgs e)
        {
            if (_isHitTesting)
                return;

            try
            {
                _isHitTesting = true;

                Point screenPoint = e.GetCurrentPoint(mapView).Position;
                var graphic = await _graphicsLayer.HitTestAsync(mapView, screenPoint);
                if (graphic != null)
                {
                    maptipTransform.X = screenPoint.X + 4;
                    maptipTransform.Y = screenPoint.Y - mapTip.ActualHeight;
                    mapTip.DataContext = graphic;
                    mapTip.Visibility = Visibility.Visible;
                }
                else
                    mapTip.Visibility = Visibility.Collapsed;
            }
            catch
            {
                mapTip.Visibility = Visibility.Collapsed;
            }
            finally
            {
                _isHitTesting = false;
            }
        }
示例#24
0
 protected override void OnPointerPressed(PointerRoutedEventArgs e)
 {
     var position = e.GetCurrentPoint(SettingsPanel).Position.X < 0;
       if (SettingsPanel.Margin.Right == 0 && position)
     SettingsPanel.Margin = new Thickness(0, 0, -346, 0);
       base.OnPointerPressed(e);
 }
 public static void OnPointerPressed(RadialSlider slider, PointerRoutedEventArgs e)
 {
     slider.CapturePointer(e.Pointer);
     _lastPoint = e.GetCurrentPoint(slider);
     _isDragActive = true;
     e.Handled = true;
 }
 public static void OnPointerPressed(UIElement sender, TouchSliderC slider, PointerRoutedEventArgs e)
 {
     sender.CapturePointer(e.Pointer);
     _lastPoint = e.GetCurrentPoint(slider);
     _isDragActive = true;
     e.Handled = true;
 }
示例#27
0
        /**
         * ホイールによるスライダーの操作にも対応しておこう。
         */
        private void OnSliderWheelChanged(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            var elem = sender as UIElement;

            if (null != elem)
            {
                int delta = e.GetCurrentPoint(elem).Properties.MouseWheelDelta;
                if (0 != delta)
                {
                    //Debug.WriteLine("Pointer: WheelChanged", delta);
                    delta = (delta > 0) ? 1 : -1;
                    double v = mSlider.Value + delta * mSlider.SmallChange;
                    if (v < mSlider.Minimum)
                    {
                        v = mSlider.Minimum;
                    }
                    else if (v > mSlider.Maximum)
                    {
                        v = mSlider.Maximum;
                    }
                    mSlider.Value = v;
                }
            }
            e.Handled = true;
        }
示例#28
0
        private void PlayArea_PointerPressed(object sender, PointerRoutedEventArgs e)
        {
            if (!_gameBoard.Interactable)
                return;

            if (_clickedPoint.Equals(EmptyPoint))
            {
             				_clickedPoint = e.GetCurrentPoint(PlayArea).Position;
                int row = (int)e.GetCurrentPoint(PlayArea).Position.Y / 60;
                int col = (int)e.GetCurrentPoint(PlayArea).Position.X / 60;

                _selectionSquare.Visibility = Visibility.Visible;
                _selectionSquare.SetValue(Canvas.LeftProperty, col * 60);
                _selectionSquare.SetValue(Canvas.TopProperty, row * 60);
            }
            else
            {
                int clickedRow = (int) _clickedPoint.Y/60;
                int clickedCol = (int) _clickedPoint.X/60;

                int row = (int) e.GetCurrentPoint(PlayArea).Position.Y/60;
                int col = (int) e.GetCurrentPoint(PlayArea).Position.X/60;
                _gameBoard.Swap(row, col, clickedRow, clickedCol);
                _clickedPoint = EmptyPoint;
                _selectionSquare.Visibility = Visibility.Collapsed;
            }
        }
示例#29
0
        public void OnPointerPressed(InqCanvas inqCanvas, PointerRoutedEventArgs e)
        {
            Debug.WriteLine(e.Pointer.PointerDeviceType);
            _currentStroke = new PointCollection();
            _polyline = new Polyline
            {
                Stroke = new SolidColorBrush(StrokeColor),
                StrokeThickness = 3,
                StrokeLineJoin = PenLineJoin.Round
            };
            inqCanvas.Children.Add(_polyline);

            _polyline.Points = _currentStroke;

            var point = e.GetCurrentPoint(inqCanvas);

            _strokeBuilder.BeginStroke(point);
            _currentStroke.Add(point.Position);

            //_inkManager.

            /*
            //TODO: add data binding for thickness and color
            _currentStroke.StrokeThickness = Math.Max(4.0 * e.GetCurrentPoint(inqCanvas).Properties.Pressure, 2);
            _currentInqLineView.StrokeThickness = _currentStroke.StrokeThickness;
            inqCanvas.Children.Add(_currentInqLineView);
            var currentPoint = e.GetCurrentPoint(inqCanvas);
            _currentStroke.AddPoint(new Point(currentPoint.Position.X, currentPoint.Position.Y));
            */
        }
示例#30
0
        private void Canvas_PointerMoved_1(object sender, PointerRoutedEventArgs e)
        {
            Canvas canvas = (sender as Canvas);
            if (canvas == null) return;
            Windows.UI.Input.PointerPoint pt = e.GetCurrentPoint(canvas);
            uint ptrId = pt.PointerId;

            if (contacts.ContainsKey(ptrId) && contacts[ptrId].HasValue)
            {
                Point currentContact = pt.Position;
                Point previousContact = contacts[ptrId].Value;
                if (Distance(currentContact, previousContact) > 4)
                {
                    Line l = new Line()
                    {
                        X1 = previousContact.X,
                        Y1 = previousContact.Y,
                        X2 = currentContact.X,
                        Y2 = currentContact.Y,
                        StrokeThickness = STROKETHICKNESS,
                        Stroke = new SolidColorBrush(Colors.Red),
                        StrokeEndLineCap = PenLineCap.Round
                    };

                    contacts[ptrId] = currentContact;
                    canvas.Children.Add(l);
                }
            }
        }
示例#31
0
 //PointerRoutedEventArgs
 public UwpTapEventArgs(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Input.PointerRoutedEventArgs args, int numberOfTaps)
 {
     ViewPosition = element.GetXfViewFrame();
     //Touches = new Xamarin.Forms.Point[] { args.GetCurrentPoint(null).Position.ToXfPoint() };
     Touches      = new Xamarin.Forms.Point[] { args.GetCurrentPoint(element).Position.ToXfPoint() };
     NumberOfTaps = numberOfTaps;
 }
示例#32
0
        private void OnPointerWheelChanged(object sender, PointerRoutedEventArgs e)
        {
            if (_isBusy)
            {
                return;
            }

            if (_panel.ItemsFitContent)
            {
                return;
            }

            var point = e.GetCurrentPoint(this);
            int sign = Math.Sign(point.Properties.MouseWheelDelta);
            if (sign > 0)
            {
                _headerContainer.TranslateDeltaX(1);
                _panelContainer.TranslateDeltaX(1);
                AnimatePrev();
            }
            else
            {
                _headerContainer.TranslateDeltaX(-1);
                _panelContainer.TranslateDeltaX(-1);
                AnimateNext();
            }
            e.Handled = true;
        }
        void Scenario1OutputRoot_PointerMoved(object sender, PointerRoutedEventArgs e)
        {
            Windows.UI.Input.PointerPoint pt = e.GetCurrentPoint(Scenario1OutputRoot);
            uint ptrId = pt.PointerId;
            if (pt.Properties.PointerUpdateKind != Windows.UI.Input.PointerUpdateKind.Other)
            {
                this.buttonPress.Text = pt.Properties.PointerUpdateKind.ToString();
            }
            if (contacts.ContainsKey(ptrId) && contacts[ptrId].HasValue)
            {
                Point currentContact = pt.Position;
                Point previousContact = contacts[ptrId].Value;
                if (Distance(currentContact, previousContact) > 4)
                {
                    Line l = new Line()
                    {
                        X1 = previousContact.X,
                        Y1 = previousContact.Y,
                        X2 = currentContact.X,
                        Y2 = currentContact.Y,
                        StrokeThickness = STROKETHICKNESS,
                        Stroke = new SolidColorBrush(Colors.Red),
                        StrokeEndLineCap = PenLineCap.Round
                    };

                    contacts[ptrId] = currentContact;
                    ((System.Collections.Generic.IList<UIElement>)Scenario1OutputRoot.Children).Add(l);
                }
            }

            e.Handled = true;
        }
 //! @brief  handle the user starting to drive
 private void PointerPressed(object sender, PointerRoutedEventArgs args) {
     Windows.UI.Input.PointerPoint pointer = args.GetCurrentPoint(null);
     if (pointer.Properties.IsLeftButtonPressed) {
         m_initialPoint = new Point(pointer.RawPosition.X - m_translateTransform.X, pointer.RawPosition.Y - m_translateTransform.Y);
         args.Handled = true;
         m_puckControl.CapturePointer(args.Pointer);
     }
 }
        /// <summary>
        /// Stores current mouse position.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="PointerRoutedEventArgs"/> instance containing the event data.</param>
        private void OnMainPage_PointerMoved(object sender, PointerRoutedEventArgs e)
        {
            if (e.Pointer.PointerDeviceType != PointerDeviceType.Mouse) { return; }

            m_isMouseInside = true;
            m_mouseID = e.Pointer.PointerId;
            m_mousePosition = Point.FromWinRTPoint(e.GetCurrentPoint(this).Position);
        }
示例#36
0
        private void UIElement_PointerReleased(object sender, PointerRoutedEventArgs args)
        {
            ((UIElement)sender).ReleasePointerCapture(args.Pointer);

            var pointerPoint = args.GetCurrentPoint(null);
            PointerReleased(pointerPoint, sender as UIElement, args.Pointer);
            args.Handled = true;
        }
示例#37
0
 private void DrawingBoard_PointerPressed(object sender, PointerRoutedEventArgs e)
 {
     lock (_renderer)
     {
         _renderer.OnPointerPressed(e.GetCurrentPoint(DrawingControl));
     }
     DrawingControl.Invalidate();
 }
示例#38
0
        private void MyCanvas_PointerMoved(object sender, PointerRoutedEventArgs e)
        {
            PointerPoint point = e.GetCurrentPoint(this); //Returns cursor location                                                 

            //Move paddle in X
            game.paddle.Move(point.Position.X);

        }
示例#39
0
 private void OnPointerPressed(object sender, PointerRoutedEventArgs e)
 {
     if (e.Pointer.PointerDeviceType == PointerDeviceType.Mouse &&
         CapturePointer(e.Pointer))
     {
         mousePosition = e.GetCurrentPoint(this).Position;
     }
 }
        protected override void OnPointerPressed(PointerRoutedEventArgs e)
        {
            var pos = e.GetCurrentPoint(_trackBackground).Position;
            _thumbPressed = pos.Y >= _thumb.Offset.Y && pos.Y <= (_thumb.Offset.Y + 36);

            VisualStateManager.GoToState(this, "Pressed", true);
            TouchSliderCDragValueHandler.OnPointerPressed(this, this, e);
        }
        void Pointer_Pressed(object sender, PointerRoutedEventArgs e)
        {
            Windows.UI.Input.PointerPoint currentPoint = e.GetCurrentPoint(mainCanvas);

            // Retrieve the properties for the curret PointerPoint and display
            // them alongside the pointer's location on screen
            CreateOrUpdatePropertyPopUp(currentPoint);
        }
        void Pointer_Released(object sender, PointerRoutedEventArgs e)
        {
            // Retrieve the point associated with the current event
            Windows.UI.Input.PointerPoint currentPoint = e.GetCurrentPoint(mainCanvas);

            // Remove the popup corresponding to the pointer
            HidePropertyPopUp(currentPoint);
        }
 private void MainCanvas_PointerMoved(object sender, PointerRoutedEventArgs e)
 {
     if (_line != null)
     {
         var position = e.GetCurrentPoint(MainCanvas).Position;
         _line.Points.Add(position);
     }
 }
示例#44
0
        void OnPointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs args)
        {
            gestureController.PointerPressed();

            this.gestureRecognizer.ProcessDownEvent(args.GetCurrentPoint(this.element));
            this.element.CapturePointer(args.Pointer);
            args.Handled = true;
        }
示例#45
0
        private void mainGrid_PointerMoved(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            return;

            Point pt = e.GetCurrentPoint(recCP).RawPosition;

            TiltEffect(pt);
        }
 void itemGridView_PointerPressed(object sender, PointerRoutedEventArgs e)
 {
     if (e.GetCurrentPoint(this).Properties.IsRightButtonPressed)
     {
         this.BottomAppBar.IsOpen = true;
         e.Handled = true;
     }
 }
        private void LocationMap_PointerPressedOverride(object sender, PointerRoutedEventArgs e)
        {
            Location location = new Location();
            Point point = e.GetCurrentPoint(this.LocationMap).Position;
            this.LocationMap.TryPixelToLocation(point, out location);

            this.LatBox.Text = location.Latitude.ToString();
            this.LonBox.Text = location.Longitude.ToString();
        }
示例#48
0
 void scrollableContent_PointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
 {
     if (this.IsPullToRefreshEnabled)
     {
         startPoint        = e.GetCurrentPoint(this.scrollableContent).Position;
         pointerPressed    = true;
         startScrollOffset = this.virtualizationStrategy.LayoutOrientation == Orientation.Vertical ? this.manipulationContainer.VerticalOffset : this.manipulationContainer.HorizontalOffset;
     }
 }
示例#49
0
        /// <summary>
        /// Called before the PointerMoved event occurs.
        /// </summary>
        /// <param name="e">Event data for the event.</param>
        protected override void OnPointerMoved(Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            base.OnPointerMoved(e);

            if (e != null)
            {
                this.OnPointerMoved(e.GetCurrentPoint(this).Position);
            }
        }
示例#50
0
        void OutControl_PointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            if (TargetCanvas == null)
            {
                return;
            }

            PointX      = e.GetCurrentPoint(TargetCanvas).Position.X;
            PointY      = e.GetCurrentPoint(TargetCanvas).Position.Y;
            CurrentLink = null;
            TargetCanvas.PointerMoved    += TargetCanvas_PointerMoved;
            TargetCanvas.PointerReleased += TargetCanvas_PointerReleased;
            IsConnecting      = true;
            CurrentConnection = this;
            //CurrentOutControl = sender as FrameworkElement;
            e.Handled = true;
            //System.Windows.DragDrop.DoDragDrop(OutControl, OutControl, DragDropEffects.Copy);
        }
示例#51
0
 void OnPointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs args)
 {
     // Route the events to the gesture recognizer
     // The points are in the reference frame of the canvas that contains the rectangle element.
     this.gestureRecognizer.ProcessDownEvent(args.GetCurrentPoint(this.reference));
     // Set the pointer capture to the element being interacted with
     this.element.CapturePointer(args.Pointer);
     // Mark the event handled to prevent execution of default handlers
     args.Handled = true;
 }
示例#52
0
        //PointerRoutedEventArgs
        public UwpTapEventArgs(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Input.PointerRoutedEventArgs args, int numberOfTaps)
        {
            ElementPosition = element.GetXfViewFrame();
            //ElementTouches = new Xamarin.Forms.Point[] { args.GetCurrentPoint(null).Position.ToXfPoint() };
            var point = args.GetCurrentPoint(element).Position;

            ElementTouches = new Xamarin.Forms.Point[] { point.ToXfPoint() };
            WindowTouches  = new Xamarin.Forms.Point[] { element.PointInNativeAppWindowCoord(point).ToXfPoint() };
            NumberOfTaps   = numberOfTaps;
        }
示例#53
0
        void itemscontrol_PointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            if (!e.GetCurrentPoint(null).Properties.IsMiddleButtonPressed)
            {
                return;
            }

            _pressedPoint = e.GetCurrentPoint(null).Position;
            Canvas.SetLeft(_middleClickFlyout, _pressedPoint.X - 15);
            Canvas.SetTop(_middleClickFlyout, _pressedPoint.Y - 15);
            VerticalSpeed             = 0;
            HorizontalSpeed           = 0;
            IsAutoScrollEnabled       = true;
            _middleClickFlyout.IsOpen = true;
            _dt.Start();
            _middleClickFlyout.Closed += _autoScrollNavigationFlyout_Closed;
            Window.Current.CoreWindow.PointerMoved += CoreWindow_PointerMoved;
            e.Handled = true;
        }
示例#54
0
        private void MainScrollviewer_PointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            var scrollViewer = sender as ScrollViewer;

            pointer          = e.Pointer;
            scrollMousePoint = e.GetCurrentPoint(scrollViewer);
            hOff             = scrollViewer.HorizontalOffset;
            vOff             = scrollViewer.VerticalOffset;
            scrollViewer.CapturePointer(pointer);
        }
示例#55
0
        private void GameCanvas_PointerMoved(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            updateMousePoint(sender, e);
            // Update the mousePointer for the clicked location
            Pointer ptr = e.Pointer;

            // Create a pointer for the clicked location

            if (ptr.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Mouse) // If the input device is a mouse
            {
                Windows.UI.Input.PointerPoint ptrPt = e.GetCurrentPoint(GameCanvas);
                if (ptrPt.Properties.IsLeftButtonPressed && !holding) //If the mouse is pressed
                {
                    if (player.currentWeapon.ShouldRepeat)            // If its a automatic weapon
                    {
                        holding    = true;
                        shootTimer = ThreadPoolTimer.CreatePeriodicTimer(ShootTimerHandler, new TimeSpan(0, 0, 0, 0, player.currentWeapon.BulletsPerMilliSecond));
                        // Shoot multiple times when the mouse is hold down
                    }
                }
            }
            float xPos = (float)e.GetCurrentPoint(GameCanvas).RawPosition.X;
            // The X location where is clicked
            float yPos = (float)e.GetCurrentPoint(GameCanvas).RawPosition.Y;

            // The Y location  where is clicked

            xVelAR = xPos - player.x;
            // The X velocity
            yVelAR = yPos - player.y;
            // The Y velocity

            float distance = (float)Math.Sqrt(Math.Pow((double)xVelAR, 2) + Math.Pow((double)yVelAR, 2));
            // Pythagoras for calculating the distance
            float scaling = distance / 25;

            // Scale the distance

            xVelAR = xVelAR / scaling;
            yVelAR = yVelAR / scaling;
        }
示例#56
0
        private void AngleBgImg_PointerMoved(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            Point currentLocation = e.GetCurrentPoint(AngleGrid).Position;

            if (_angleImgPressing)
            {
                double dx  = currentLocation.X - AngleImgCenter.X;
                double dy  = currentLocation.Y - AngleImgCenter.Y;
                double hue = Math2.ComputeH(dx, dy);
                AngleIcImgRotation.Angle = hue;
            }
        }
示例#57
0
        void ll_PointerMoved(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            if (!_IsEnableLeft)
            {
                return;
            }
            if (BeginDrag)
            {
                double dx = e.GetCurrentPoint(null).Position.X - x0;
                x0 = e.GetCurrentPoint(null).Position.X;
                Panel  p = (Panel)uc.Parent;
                double d = R - e.GetCurrentPoint(p).Position.X;
                if ((d < _MinWidth) || (d > _MaxWidth))//比最小值大
                {
                    return;
                }
                fo.Width = fo.Width - dx;

                //if (d < MinDis) { d = MinDis; }
                so.Parent.SetValue(Canvas.LeftProperty, R - d);
                so.Width = d;
                uc.Width = d;
                ll.Y1    = 0;
                ll.Y2    = so.ActualHeight;
                ll.X1    = 0;
                ll.X2    = 0;
                tl.X1    = 0;
                tl.X2    = so.ActualWidth;
                bl.X1    = 0;
                bl.X2    = so.ActualWidth;
                rl.X1    = so.ActualWidth;
                rl.X2    = so.ActualWidth;

                setClip();
                if (lynxResized != null)
                {
                    lynxResized();
                }                                          //回调,通知布局对象修改了布局
            }
        }
示例#58
0
        public void Stop(Windows.UI.Xaml.Input.PointerRoutedEventArgs e, Action action)
        {
            if (!IsDragging)
            {
                return;
            }
            (e.OriginalSource as UIElement).ReleasePointerCapture(e.Pointer);

            EndPoint   = e.GetCurrentPoint(canvas);
            IsDragging = false;

            action();
        }
 private void xThumbRectangle_PointerMoved(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
 {
     e.Handled = true;
     if (!_isEnable || _naturalDuration == null || !_naturalDuration.HasTimeSpan)
     {
         return;
     }
     if (_isDragging)
     {
         var positon = e.GetCurrentPoint(xSliderGrid).Position.X - _orientalThumbPosition;
         SetCurrentThumbPosition(positon);
     }
 }
 private void xThumbVolumeRectangle_PointerReleased(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
 {
     e.Handled = true;
     if (_isDraggingOfVolume)
     {
         _isDraggingOfVolume = false;
         double value = (e.GetCurrentPoint(xVolumeSliderGrid).Position.X - _orientalThumbVolumePosition) / (350 - _thumbVolumeWidth);
         //if (VolumeChanged != null)
         //    VolumeChanged(sender, value);
         SetVolumeState(value);
     }
     xThumbVolumeRectangle.ReleasePointerCaptures();
 }