/// <summary>
        /// Convert the clicked position (PointerPoint) into the nearest grid piont
        /// </summary>
        internal static Point ConvertClickedPoint2NearestGridPoint_WithOffset(UIElement uiElementCanvas, UIElement uiElementStackPanel, PointerPoint pointClicked)
        {
            Point canvasOffset = GetCanvasOffset(uiElementCanvas, uiElementStackPanel);

            double xConverted = (pointClicked.Position.X - canvasOffset.X) / gridDistance;
            double yConverted = (pointClicked.Position.Y - canvasOffset.Y) / gridDistance;

            // get the nearest grid point
            Point gridPointClicked;

            gridPointClicked.X = (uint)Math.Round(xConverted);
            gridPointClicked.Y = (uint)Math.Round(yConverted);
            return(gridPointClicked);
        }
Exemplo n.º 2
0
    internal PointerPoint ToPointerPoint(InjectedInputState state)
    {
        var isNew      = PointerOptions.HasFlag(InjectedInputPointerOptions.New);
        var properties = isNew
                        ? new PointerPointProperties()
                        : new PointerPointProperties(state.Properties);

        properties.IsPrimary = PointerOptions.HasFlag(InjectedInputPointerOptions.Primary);
        properties.IsInRange = PointerOptions.HasFlag(InjectedInputPointerOptions.InRange);
        // IsLeftButtonPressed = // stateful, cf. below,
        // IsMiddleButtonPressed = // Mouse only
        // IsRightButtonPressed = // stateful, cf. below,
        // IsHorizontalMouseWheel = // Mouse only
        // IsXButton1Pressed =
        // IsXButton2Pressed =
        // IsBarrelButtonPressed = // Pen only
        // IsEraser = // Pen only
        // Pressure = // Touch only
        // Orientation = // Touch only
        // ContactRect = new Rect(Contact.Left, Contact.Top, Contact.Right - Contact.Left, Contact.Bottom - Contact.Top),
        properties.TouchConfidence = PointerOptions.HasFlag(InjectedInputPointerOptions.Confidence);
        properties.IsCanceled      = PointerOptions.HasFlag(InjectedInputPointerOptions.Canceled);

        var update = default(PointerUpdateKind);

        if (PointerOptions.HasFlag(InjectedInputPointerOptions.FirstButton))
        {
            if (PointerOptions.HasFlag(InjectedInputPointerOptions.PointerDown))
            {
                properties.IsLeftButtonPressed = true;
                update |= PointerUpdateKind.LeftButtonPressed;
            }
            else if (PointerOptions.HasFlag(InjectedInputPointerOptions.PointerUp))
            {
                properties.IsLeftButtonPressed = false;
                update |= PointerUpdateKind.LeftButtonReleased;
            }
        }
        if (PointerOptions.HasFlag(InjectedInputPointerOptions.SecondButton))
        {
            if (PointerOptions.HasFlag(InjectedInputPointerOptions.PointerDown))
            {
                properties.IsRightButtonPressed = true;
                update |= PointerUpdateKind.RightButtonPressed;
            }
            else if (PointerOptions.HasFlag(InjectedInputPointerOptions.PointerUp))
            {
                properties.IsRightButtonPressed = false;
                update |= PointerUpdateKind.RightButtonReleased;
            }
        }

        properties.PointerUpdateKind = update;
        if (state.Type is PointerDeviceType.Pen)
        {
            properties.IsBarrelButtonPressed = properties.IsRightButtonPressed;
        }

        var location = new Point(PixelLocation.PositionX, PixelLocation.PositionY);
        var point    = new PointerPoint(
            state.FrameId + TimeOffsetInMilliseconds,
            state.Timestamp + PerformanceCount,
            PointerDevice.For(state.Type),
            isNew ? PointerId : state.PointerId,
            location,
            location,
            PointerOptions.HasFlag(InjectedInputPointerOptions.InContact),
            properties);

        return(point);
    }
Exemplo n.º 3
0
        public bool Uncapture(PointerPoint point, int pointerIndex)
        {
            if (pointerIndex == 0)
            {
                if (tryMoveTo)
                {
                    tryMoveTo = false;
                    float dx = moveToX - (int)point.Position.X;
                    float dy = moveToY - (int)point.Position.Y;
                    if (/*@event.getAction() == MotionEvent.ACTION_UP &&*/ DateTime.Now.ToTimestamp() * 1000 - startTapTime < 300 && Math.Sqrt(dx * dx + dy * dy) < 10)
                    {
                        float moveToX     = (this.moveToX - BaseChartView.HORIZONTAL_PADDING) / pickerWidth;
                        float w           = pickerEnd - pickerStart;
                        float moveToLeft  = moveToX - w / 2f;
                        float moveToRight = moveToX + w / 2f;
                        if (moveToLeft < 0f)
                        {
                            moveToLeft  = 0;
                            moveToRight = w;
                        }
                        else if (moveToRight > 1f)
                        {
                            moveToLeft  = 1f - w;
                            moveToRight = 1f;
                        }
                        float moveFromLeft  = pickerStart;
                        float moveFromRight = pickerEnd;

                        moveToAnimator = ValueAnimator.OfFloat(0f, 1f);
                        float finalMoveToLeft  = moveToLeft;
                        float finalMoveToRight = moveToRight;
                        view.OnPickerJumpTo(finalMoveToLeft, finalMoveToRight, true);
                        moveToAnimator.AddUpdateListener(new AnimatorUpdateListener(animation =>
                        {
                            float v     = (float)animation.GetAnimatedValue();
                            pickerStart = moveFromLeft + (finalMoveToLeft - moveFromLeft) * v;
                            pickerEnd   = moveFromRight + (finalMoveToRight - moveFromRight) * v;
                            view.OnPickerJumpTo(finalMoveToLeft, finalMoveToRight, false);
                        }));
                        moveToAnimator.setInterpolator(BaseChartView.INTERPOLATOR);
                        moveToAnimator.Start();
                    }
                    return(true);
                }

                if (capturedStates[0] != null)
                {
                    capturedStates[0].uncapture();
                }

                capturedStates[0] = null;
                if (capturedStates[1] != null)
                {
                    capturedStates[0] = capturedStates[1];
                    capturedStates[1] = null;
                }
            }
            else
            {
                if (capturedStates[1] != null)
                {
                    capturedStates[1].uncapture();
                }

                capturedStates[1] = null;
            }
            return(false);
        }
Exemplo n.º 4
0
 public static PointF ToPointF(this PointerPoint point)
 {
     return(new PointF((float)point.RawPosition.X, (float)point.RawPosition.Y));
 }
Exemplo n.º 5
0
 private void PointerPressed(InkPoint canvasSharp, PointerPoint p)
 {
     TmpPoint = p.Position;
     Drawer.GraphicsRects.ForEach(g => g.BeginMove(canvasSharp, p));
 }
Exemplo n.º 6
0
        private void InkCanvas_PointerMoved(object sender, PointerRoutedEventArgs e)
        {
            if (e.Pointer.PointerId == this.penID)
            {
                PointerPoint pt = e.GetCurrentPoint(PanelCanvas);

                // Render a red line on the canvas as the pointer moves.
                // Distance() is an application-defined function that tests
                // whether the pointer has moved far enough to justify
                // drawing a new line.
                this.currentContactPt = pt.Position;
                this.x1 = this.previousContactPt.X;
                this.y1 = this.previousContactPt.Y;
                this.x2 = this.currentContactPt.X;
                this.y2 = this.currentContactPt.Y;

                if (this.Distance(this.x1, this.y1, this.x2, this.y2) > 2.0)
                {
                    Line line = new Line()
                    {
                        X1 = this.x1,
                        Y1 = this.y1,
                        X2 = this.x2,
                        Y2 = this.y2,
                        StrokeThickness = 3.0,
                        Stroke          = new SolidColorBrush(Colors.Black)
                    };

                    this.previousContactPt = this.currentContactPt;

                    // Draw the line on the canvas by adding the Line object as
                    // a child of the Canvas object.
                    PanelCanvas.Children.Add(line);

                    // Pass the pointer information to the InkManager.
                    this.inkManager.ProcessPointerUpdate(pt);
                }
            }
            else if (e.Pointer.PointerId == this.touchID)
            {
                // Process touch input
                PointerPoint pt = e.GetCurrentPoint(PanelCanvas);

                // Render a red line on the canvas as the pointer moves.
                // Distance() is an application-defined function that tests
                // whether the pointer has moved far enough to justify
                // drawing a new line.
                this.currentContactPt = pt.Position;
                this.x1 = this.previousContactPt.X;
                this.y1 = this.previousContactPt.Y;
                this.x2 = this.currentContactPt.X;
                this.y2 = this.currentContactPt.Y;

                if (this.Distance(this.x1, this.y1, this.x2, this.y2) > 2.0)
                {
                    Line line = new Line()
                    {
                        X1 = this.x1,
                        Y1 = this.y1,
                        X2 = this.x2,
                        Y2 = this.y2,
                        StrokeThickness = 4.0,
                        Stroke          = new SolidColorBrush(Colors.Green)
                    };

                    this.previousContactPt = this.currentContactPt;

                    // Draw the line on the canvas by adding the Line object as
                    // a child of the Canvas object.
                    PanelCanvas.Children.Add(line);

                    // Pass the pointer information to the InkManager.
                    this.inkManager.ProcessPointerUpdate(pt);
                }
            }
        }
Exemplo n.º 7
0
        private void Viewer_PointerWheelChanged(object sender, PointerRoutedEventArgs e)
        {
            PointerPoint           pPoint           = e.GetCurrentPoint(this);
            PointerPointProperties pPointProperties = pPoint.Properties;

            if (pPointProperties.MouseWheelDelta > 0)
            {
                if (m_iButtonArrowStatus == 1)
                {
                    m_iButtonArrowStatus         = 0;
                    m_iButtonNoEntryStatus       = 1;
                    m_iButtonArrowGuidanceStatus = 0;

                    changeButtonBackground(bnArrow, "target_Unselected.png");
                    changeButtonBackground(bnNoEntry, "noEntry_Selected.png");
                    changeButtonBackground(bnArrowGuidance, "arrowGuide_Unselected.png");

                    sendUdpMessageANNOTATION_SELECTION(ANNOTATIONS.ANNOTATIONS_NOENTRY);
                }
                else if (m_iButtonNoEntryStatus == 1)
                {
                    m_iButtonArrowStatus         = 0;
                    m_iButtonNoEntryStatus       = 0;
                    m_iButtonArrowGuidanceStatus = 1;

                    changeButtonBackground(bnArrow, "target_Unselected.png");
                    changeButtonBackground(bnNoEntry, "noEntry_Unselected.png");
                    changeButtonBackground(bnArrowGuidance, "arrowGuide_Selected.png");

                    sendUdpMessageANNOTATION_SELECTION(ANNOTATIONS.ANNOTATION_ARROWGUIDANCE_SHOW);
                }
                else if (m_iButtonArrowGuidanceStatus == 1)
                {
                    m_iButtonArrowStatus         = 1;
                    m_iButtonNoEntryStatus       = 0;
                    m_iButtonArrowGuidanceStatus = 0;

                    changeButtonBackground(bnArrow, "target_Selected.png");
                    changeButtonBackground(bnNoEntry, "noEntry_Unselected.png");
                    changeButtonBackground(bnArrowGuidance, "arrowGuide_Unselected.png");

                    sendUdpMessageANNOTATION_SELECTION(ANNOTATIONS.ANNOTATION_ARROWGUIDANCE_HIDE);
                    sendUdpMessageANNOTATION_SELECTION(ANNOTATIONS.ANNOTATIONS_ARROW);
                }
            }
            else if (pPointProperties.MouseWheelDelta < 0)
            {
                if (m_iButtonArrowStatus == 1)
                {
                    m_iButtonArrowStatus         = 0;
                    m_iButtonNoEntryStatus       = 0;
                    m_iButtonArrowGuidanceStatus = 1;

                    changeButtonBackground(bnArrow, "target_Unselected.png");
                    changeButtonBackground(bnNoEntry, "noEntry_Unselected.png");
                    changeButtonBackground(bnArrowGuidance, "arrowGuide_Selected.png");

                    sendUdpMessageANNOTATION_SELECTION(ANNOTATIONS.ANNOTATION_ARROWGUIDANCE_SHOW);
                }
                else if (m_iButtonNoEntryStatus == 1)
                {
                    m_iButtonArrowStatus         = 1;
                    m_iButtonNoEntryStatus       = 0;
                    m_iButtonArrowGuidanceStatus = 0;

                    changeButtonBackground(bnArrow, "target_Selected.png");
                    changeButtonBackground(bnNoEntry, "noEntry_Unselected.png");
                    changeButtonBackground(bnArrowGuidance, "arrowGuide_Unselected.png");

                    sendUdpMessageANNOTATION_SELECTION(ANNOTATIONS.ANNOTATIONS_ARROW);
                }
                else if (m_iButtonArrowGuidanceStatus == 1)
                {
                    m_iButtonArrowStatus         = 0;
                    m_iButtonNoEntryStatus       = 1;
                    m_iButtonArrowGuidanceStatus = 0;

                    changeButtonBackground(bnArrow, "target_Unselected.png");
                    changeButtonBackground(bnNoEntry, "noEntry_Selected.png");
                    changeButtonBackground(bnArrowGuidance, "arrowGuide_Unselected.png");

                    sendUdpMessageANNOTATION_SELECTION(ANNOTATIONS.ANNOTATION_ARROWGUIDANCE_HIDE);
                    sendUdpMessageANNOTATION_SELECTION(ANNOTATIONS.ANNOTATIONS_NOENTRY);
                }
            }
        }
Exemplo n.º 8
0
 private void AppendPenProperties(StringBuilder sb, PointerPoint p)
 {
     sb.AppendFormat("Er:{0}; Rng:{1}; Inv:{2}; Or:{3}; Tw:{4}; Tx:{5}; Ty:{6}", p.IsEraser, p.IsInRange, p.IsInverted, p.Orientation, p.Twist, p.XTilt, p.YTilt);
 }
Exemplo n.º 9
0
 private void AppendTouchProperties(StringBuilder sb, PointerPoint p)
 {
     sb.AppendFormat("L:{0}; C:{1}; T:{2}; R:{3}", p.IsLeftButtonPressed, p.IsCanceled, p.TouchConfidence, p.IsInRange);
 }
Exemplo n.º 10
0
 private void UpdateSpectrumPointer(PointerPoint pointer)
 {
     UpdateSpectrumPointer(pointer.Position, true);
 }
Exemplo n.º 11
0
 private void AppendMouseProperties(StringBuilder sb, PointerPoint p)
 {
     sb.AppendFormat("L:{0}; R:{1}; M:{2}; d:{3}", p.IsLeftButtonPressed, p.IsRightButtonPressed, p.IsMiddleButtonPressed, p.MouseWheelDelta);
 }
Exemplo n.º 12
0
 private void layoutRoot_PointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
 {
     IsMouseDown = true;
     ptStart     = e.GetCurrentPoint(null);
 }
        private void UpdatePointerForEvent(ReactPointer pointer, PointerPoint rootPoint, PointerPoint viewPoint)
        {
            var positionInRoot = rootPoint.Position;
            var positionInView = viewPoint.Position;

            pointer.PageX                 = (float)positionInRoot.X;
            pointer.PageY                 = (float)positionInRoot.Y;
            pointer.LocationX             = (float)positionInView.X;
            pointer.LocationY             = (float)positionInView.Y;
            pointer.Timestamp             = rootPoint.Timestamp / 1000; // Convert microseconds to milliseconds;
            pointer.Force                 = rootPoint.Properties.Pressure;
            pointer.IsBarrelButtonPressed = rootPoint.Properties.IsBarrelButtonPressed;

            pointer.ShiftKey = Window.Current.CoreWindow.GetKeyState(Windows.System.VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down);
            pointer.AltKey   = Window.Current.CoreWindow.GetKeyState(Windows.System.VirtualKey.Menu).HasFlag(CoreVirtualKeyStates.Down);
            pointer.CtrlKey  = Window.Current.CoreWindow.GetKeyState(Windows.System.VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down);
        }
Exemplo n.º 14
0
 /// <summary>
 /// Invoked when the player starts touching the screen
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Frame_PointerPressed(object sender, PointerRoutedEventArgs e)
 {
     // Gets the coordinates of the point on the screen that was touched
     ppPointerPress = e.GetCurrentPoint(Frame);
 }
        private void UpdatePointerForEvent(ReactPointer pointer, PointerPoint rootPoint, PointerPoint viewPoint, VirtualKeyModifiers keyModifiers)
        {
            var positionInRoot = rootPoint.Position;
            var positionInView = viewPoint.Position;

            pointer.PageX                 = (float)positionInRoot.X;
            pointer.PageY                 = (float)positionInRoot.Y;
            pointer.LocationX             = (float)positionInView.X;
            pointer.LocationY             = (float)positionInView.Y;
            pointer.Timestamp             = rootPoint.Timestamp / 1000; // Convert microseconds to milliseconds;
            pointer.Force                 = rootPoint.Properties.Pressure;
            pointer.IsBarrelButtonPressed = rootPoint.Properties.IsBarrelButtonPressed;

            pointer.ShiftKey = keyModifiers.HasFlag(VirtualKeyModifiers.Shift);
            pointer.AltKey   = keyModifiers.HasFlag(VirtualKeyModifiers.Menu);
            pointer.CtrlKey  = keyModifiers.HasFlag(VirtualKeyModifiers.Control);
        }
Exemplo n.º 16
0
 public PointerEventDescrption(int index, PointerPoint point)
 {
     this.index       = index;
     this.point       = point;
     this.description = point.EventType.ToString();
 }
 private void MainPage_PointerMoved(object sender, PointerRoutedEventArgs e)
 {
     _point = e.GetCurrentPoint(this);
     CreateSprite(Color.FromArgb(0x30, 0x00, 0x90, 0x00));
 }
Exemplo n.º 18
0
        private void NotesCanvasLeftPointerPressed(Canvas canvas, PointerPoint point, PointerPressedEventArgs args)
        {
            var pitHitInfo = ViewModel.NotesViewModel.HitTest.HitTestPitchPoint(point.Position);

            if (pitHitInfo.Note != null)
            {
                editState = new PitchPointEditState(canvas, ViewModel,
                                                    pitHitInfo.Note, pitHitInfo.Index, pitHitInfo.OnPoint, pitHitInfo.X, pitHitInfo.Y);
                return;
            }
            var vbrHitInfo = ViewModel.NotesViewModel.HitTest.HitTestVibrato(point.Position);

            if (vbrHitInfo.hit)
            {
                if (vbrHitInfo.hitToggle)
                {
                    ViewModel.NotesViewModel.ToggleVibrato(vbrHitInfo.note);
                    return;
                }
                if (vbrHitInfo.hitStart)
                {
                    editState = new VibratoChangeStartState(canvas, ViewModel, vbrHitInfo.note);
                    return;
                }
                if (vbrHitInfo.hitIn)
                {
                    editState = new VibratoChangeInState(canvas, ViewModel, vbrHitInfo.note);
                    return;
                }
                if (vbrHitInfo.hitOut)
                {
                    editState = new VibratoChangeOutState(canvas, ViewModel, vbrHitInfo.note);
                    return;
                }
                if (vbrHitInfo.hitDepth)
                {
                    editState = new VibratoChangeDepthState(canvas, ViewModel, vbrHitInfo.note);
                    return;
                }
                if (vbrHitInfo.hitPeriod)
                {
                    editState = new VibratoChangePeriodState(canvas, ViewModel, vbrHitInfo.note);
                    return;
                }
                if (vbrHitInfo.hitShift)
                {
                    editState = new VibratoChangeShiftState(
                        canvas, ViewModel, vbrHitInfo.note, vbrHitInfo.point, vbrHitInfo.initialShift);
                    return;
                }
                return;
            }
            var noteHitInfo = ViewModel.NotesViewModel.HitTest.HitTestNote(point.Position);

            if (args.KeyModifiers == KeyModifiers.Control)
            {
                // New selection.
                ViewModel.NotesViewModel.DeselectNotes();
                editState = new NoteSelectionEditState(canvas, ViewModel, GetSelectionBox(canvas));
                Cursor    = ViewConstants.cursorCross;
                return;
            }
            if (args.KeyModifiers == (KeyModifiers.Control | KeyModifiers.Shift))
            {
                // Additional selection.
                editState = new NoteSelectionEditState(canvas, ViewModel, GetSelectionBox(canvas));
                Cursor    = ViewConstants.cursorCross;
                return;
            }
            if (noteHitInfo.hitBody)
            {
                if (noteHitInfo.hitResizeArea)
                {
                    editState = new NoteResizeEditState(
                        canvas, ViewModel, noteHitInfo.note,
                        args.KeyModifiers == KeyModifiers.Alt);
                    Cursor = ViewConstants.cursorSizeWE;
                }
                else
                {
                    editState = new NoteMoveEditState(canvas, ViewModel, noteHitInfo.note);
                    Cursor    = ViewConstants.cursorSizeAll;
                }
                return;
            }
            ViewModel.NotesViewModel.DeselectNotes();
            var note = ViewModel.NotesViewModel.MaybeAddNote(point.Position);

            if (note != null)
            {
                // Start moving right away
                editState = new NoteMoveEditState(canvas, ViewModel, note);
                Cursor    = ViewConstants.cursorSizeAll;
            }
        }
Exemplo n.º 19
0
    internal PointerEventArgs ToEventArgs(InjectedInputState state)
    {
        var update     = default(PointerUpdateKind);
        var position   = state.Position;
        var properties = new PointerPointProperties(state.Properties)
        {
            IsPrimary = false,
            IsInRange = true             // always true for mouse
        };

        if (MouseOptions.HasFlag(InjectedInputMouseOptions.LeftDown))
        {
            properties.IsLeftButtonPressed = true;
            update |= PointerUpdateKind.LeftButtonPressed;
        }
        else if (MouseOptions.HasFlag(InjectedInputMouseOptions.LeftUp))
        {
            properties.IsLeftButtonPressed = false;
            update |= PointerUpdateKind.LeftButtonReleased;
        }

        if (MouseOptions.HasFlag(InjectedInputMouseOptions.MiddleDown))
        {
            properties.IsMiddleButtonPressed = true;
            update |= PointerUpdateKind.MiddleButtonPressed;
        }
        else if (MouseOptions.HasFlag(InjectedInputMouseOptions.MiddleUp))
        {
            properties.IsMiddleButtonPressed = false;
            update |= PointerUpdateKind.MiddleButtonReleased;
        }

        if (MouseOptions.HasFlag(InjectedInputMouseOptions.RightDown))
        {
            properties.IsRightButtonPressed = true;
            update |= PointerUpdateKind.RightButtonPressed;
        }
        else if (MouseOptions.HasFlag(InjectedInputMouseOptions.RightUp))
        {
            properties.IsRightButtonPressed = false;
            update |= PointerUpdateKind.RightButtonReleased;
        }

        if (MouseOptions.HasFlag(InjectedInputMouseOptions.XDown))
        {
            properties.IsXButton1Pressed = true;
            update |= PointerUpdateKind.XButton1Pressed;
        }
        else if (MouseOptions.HasFlag(InjectedInputMouseOptions.XUp))
        {
            properties.IsXButton1Pressed = false;
            update |= PointerUpdateKind.XButton1Released;
        }

        if (MouseOptions.HasFlag(InjectedInputMouseOptions.Wheel))
        {
            properties.MouseWheelDelta        = DeltaY;
            properties.IsHorizontalMouseWheel = false;
        }
        else if (MouseOptions.HasFlag(InjectedInputMouseOptions.HWheel))
        {
            properties.MouseWheelDelta        = DeltaX;
            properties.IsHorizontalMouseWheel = true;
        }
        else if (MouseOptions.HasFlag(InjectedInputMouseOptions.Move) || MouseOptions.HasFlag(InjectedInputMouseOptions.MoveNoCoalesce))
        {
            properties.MouseWheelDelta        = default;
            properties.IsHorizontalMouseWheel = false;

            // Should we use MouseData ??? But How to discriminate between X and Y moves?
            position.X += DeltaX;
            position.Y += DeltaY;
        }
        else
        {
            properties.MouseWheelDelta        = default;
            properties.IsHorizontalMouseWheel = false;
        }

        properties.PointerUpdateKind = update;

        var point = new PointerPoint(
            state.FrameId + TimeOffsetInMilliseconds,
            state.Timestamp + TimeOffsetInMilliseconds,
            PointerDevice.For(PointerDeviceType.Mouse),
            uint.MaxValue - 42,             // Try to avoid conflict with the real mouse pointer
            position,
            position,
            isInContact: properties.HasPressedButton,
            properties);

        return(new PointerEventArgs(point, default));
    }
Exemplo n.º 20
0
        private void MyCanvas_PointerReleased(object sender, PointerRoutedEventArgs e)
        {
            PointerPoint pt = e.GetCurrentPoint(MyCanvas);

            e.Handled = true;
        }
        /// <summary>
        /// Handles the canvas mouse released.
        /// </summary>
        private void HandleCanvasMouseReleased(object sender, PointerRoutedEventArgs eventArguments)
        {
            PointerPoint pointerPoint = eventArguments.GetCurrentPoint(_canvas);

            _model.HandleCanvasLeftMouseReleased(new Point(pointerPoint.Position.X, pointerPoint.Position.Y));
        }
Exemplo n.º 22
0
 public override void OnDrawCommit(IModel sender, PointerPoint args)
 {
     type = T.NULL;
 }
Exemplo n.º 23
0
 private void PointerMove(InkPoint canvasSharp, PointerPoint p)
 {
     Drawer.GraphicsRects.ForEach(gr => gr.Move(canvasSharp, p));
 }
Exemplo n.º 24
0
 public override void OnDrawRollback(IModel sender, PointerPoint args)
 {
     type = T.NULL;
 }
Exemplo n.º 25
0
 private void PointerPressed(PointerPoint pointerPoint)
 {
 }
Exemplo n.º 26
0
        protected override void OnPointerPressed(PointerRoutedEventArgs e)
        {
            Debug.WriteLine(e.OriginalSource.GetType().Name);
            Debug.WriteLine("The Poine Id is :" + e.Pointer.PointerId);
            if (e.OriginalSource is Grid)
            {
                Debug.WriteLine((e.OriginalSource as Grid).Name);
            }
            base.OnPointerPressed(e);
            if (this.gridCover.Visibility == Visibility.Visible)
            {
                if (gridSetting.Visibility == Visibility.Visible)
                {
                    //  if (e.OriginalSource is Grid){
                    //  Debug.WriteLine((e.OriginalSource as Grid).Name);
                    if ((e.OriginalSource as FrameworkElement).Name == "layoutRoot")
                    {
                        Config.TraceThickness.Value  = (float)this.SliderTraceThickness.Value;
                        Config.isNeedShowTrace.Value = this.SwitchShowTrace.IsOn;
                        Config.isReserveTrace.Value  = this.SwitchKeepTrace.IsOn;
                        Config.isShowCoord.Value     = this.SwitchShowCoord.IsOn;
                        this.gridSetting.Visibility  = Visibility.Collapsed;
                        this.gridCover.Visibility    = Visibility.Collapsed;
                    }
                    else
                    {
                        return;
                    }


                    //  }
                }
                else
                {
                    this.gridCover.Visibility = Visibility.Collapsed;
                }
            }
            PointerPoint point = e.GetCurrentPoint(this);
            var          line  = new Crossline(Colors.White, point);

            line.Tag = point.PointerId;
            Color color = colors[random.Next(0, colors.Count - 1)];

            line.LineColor = color;
            CanvasLine.Children.Add(line.HorizontalPath);
            CanvasLine.Children.Add(line.VerticalPath);
            points.Add(line);
            if (points.Count > Config.supportMaxTouchs.Value)
            {
                Config.supportMaxTouchs.Value = points.Count;
            }
            if (Config.isNeedShowTrace.Value)
            {
                //var pointForTrace = new Point(point.Position.X, point.Position.Y - Config.TOUCH_Y_OFFSET);
                var pointForTrace = new Point(point.Position.X, point.Position.Y);
                var polyline      = new Polyline();
                polyline.Stroke          = new SolidColorBrush(color);
                polyline.StrokeThickness = Config.TraceThickness.Value;
                CanvasLine.Children.Add(polyline);
                LineDictionary.AddValue(point.PointerId, polyline);
            }
            if (Config.isShowCoord.Value)
            {
                TextBlock textBlock = new TextBlock();
                textBlock.TextWrapping = TextWrapping.Wrap;
                textBlock.Width        = StackPanelCoords.Width;
                textBlock.Height       = 60;
                textBlock.Tag          = point.PointerId;
                textBlock.Foreground   = new SolidColorBrush(color);
                textBlocks.Add(textBlock);
                textBlock.Text = string.Format("Point{0}:  x:{1:N0} y:{2:N0}", textBlocks.IndexOf(textBlock) + 1, point.Position.X * Config.scaleFactor,
                                               point.Position.Y * Config.scaleFactor);
                StackPanelCoords.Children.Add(textBlock);
            }
            ResetMenu();
        }
Exemplo n.º 27
0
 internal PointerEventArgs(PointerPoint currentPoint)
 {
     CurrentPoint = currentPoint;
 }
        private void OnPointerEnteredExited(TouchEventType eventType, UIElement view, PointerPoint rootPoint, PointerRoutedEventArgs e, bool sendDirect, bool sendBubbled)
        {
            var pointer = CreateReactPointer(view, rootPoint, e, false);

            view.GetReactContext()?
            .GetNativeModule <UIManagerModule>()
            .EventDispatcher
            .DispatchEvent(
                new PointerEnterExitEvent(eventType, view.GetTag(), pointer, sendDirect, sendBubbled));
            // Keeps resetting the identifier if no other non-moving pointer is present
            if (_pointers.Count == 0)
            {
                _pointerIDs = 0;
            }
        }
Exemplo n.º 29
0
 /// <summary>
 /// Lift the touch layer
 /// </summary>
 /// <param name="p"></param>
 internal void PointerUp(PointerPoint localPoint, PointerPoint globalPoint)
 {
     controllers.TouchController.TouchUp(localPoint, globalPoint);
 }
Exemplo n.º 30
0
        private void PointerReleased(object sender, PointerRoutedEventArgs e)
        {
            PointerPoint pp = e.GetCurrentPoint(renderer);

            RemoveTouch(pp);
        }