Exemple #1
0
        }//OnStrokesReplaced

        protected override void OnStylusDown(StylusDownEventArgs e)
        {
            //add styluspoint from the event after checking to ensure that the collection doesnt already posses them
            myStrokeAttManager.StrokeTime.Add(e.Timestamp);
            //Debug.WriteLine("TimeTaken_PenDown:" + e.Timestamp);
            base.OnStylusDown(e);
        }
Exemple #2
0
 private void BoardInkCanvas_OnPreviewStylusDown(object sender, StylusDownEventArgs e)
 {
     if (_editingMode == InkCanvasEditingMode.EraseByPoint)
     {
         BoardInkCanvas.EditingMode = _editingMode;
     }
 }
Exemple #3
0
        //描く処理(ペン用)
        private void inkCanvas1_StylusDown(object sender, StylusDownEventArgs e)
        {
            //消しゴムモードなら抜け出す
            if (inkCanvas1.EditingMode == InkCanvasEditingMode.EraseByPoint)
            {
                return;
            }

            UIElement el = sender as UIElement;

            //自由線
            if (isFreeLine)
            {
                dragging = true;
                points   = new List <System.Windows.Point>();
                points.Add(e.GetPosition(el));

                prevP = e.GetPosition(el);
            }

            //直線
            else
            {
                dragging = true;
                startP   = e.GetPosition(el);
            }
        }
Exemple #4
0
 private void brd_Sagust_StylusDown(object sender, StylusDownEventArgs e)
 {
     if (Mouse.LeftButton == MouseButtonState.Pressed)
     {
         this.DragMove();
     }
 }
        //形状工具
        private void inkContent_StylusDown(object sender, StylusDownEventArgs e)
        {
            StartPoint = e.GetPosition(inkContent);

            System.Windows.Shapes.Path Precttangle = new System.Windows.Shapes.Path();
            TempPath         = Precttangle;
            Precttangle.Name = "Rectangle" + StartPoint.X.ToString();
            if (ShapeSelcted == "0")
            {
                inkContent.Children.Add(Precttangle);
            }

            if (ShapeSelcted == "1")
            {
                inkContent.Children.Add(Precttangle);
            }

            if (ShapeSelcted == "2")
            {
                inkContent.Children.Add(Precttangle);
            }

            if (ShapeSelcted == "3")
            {
                inkContent.Children.Add(Precttangle);
            }
        }
        /// <summary>Retranscribe stylus event to editor</summary>
        private void captureLayer_StylusDown(object sender, StylusDownEventArgs e)
        {
            if (_inputType != InputType.NONE)
            {
                return;
            }

            if (_inputDeviceId != -1)
            {
                return;
            }

            if (!IsStylusTipDown(e))
            {
                return;
            }

            if ((e.StylusDevice.TabletDevice != null) && (e.StylusDevice.TabletDevice.Type != TabletDeviceType.Stylus))
            {
                return; // Ignore if not generated by a stylus
            }
            // Capture the stylus so all stylus input is routed to this control.
            e.StylusDevice?.Capture(sender as UIElement, CaptureMode.SubTree);

            _inputType     = InputType.STYLUS;
            _inputDeviceId = e.StylusDevice.Id;

            OnPointerDown(e);

            e.Handled = true;
        }
        protected override void OnStylusDown(StylusDownEventArgs args)
        {
            base.OnStylusDown(args);
            Point ptStylus = args.GetPosition(canv);

            // Создание основного объекта Polyline с закругленными концами отрезков
            polyStylus                    = new Polyline();
            polyStylus.Stroke             = brushStylus;
            polyStylus.StrokeThickness    = widthStroke;
            polyStylus.StrokeStartLineCap = PenLineCap.Round;
            polyStylus.StrokeEndLineCap   = PenLineCap.Round;
            polyStylus.StrokeLineJoin     = PenLineJoin.Round;
            polyStylus.Points             = new PointCollection();
            polyStylus.Points.Add(ptStylus);

            // Созданиеобъекта Polyline для имитации тени
            polyShadow                    = new Polyline();
            polyShadow.Stroke             = brushShadow;
            polyShadow.StrokeThickness    = widthStroke;
            polyShadow.StrokeStartLineCap = PenLineCap.Round;
            polyShadow.StrokeEndLineCap   = PenLineCap.Round;
            polyShadow.StrokeLineJoin     = PenLineJoin.Round;
            polyShadow.Points             = new PointCollection();
            polyShadow.Points.Add(ptStylus + vectShadow);

            //Тень вставляется перед ломаными переднего плана
            canv.Children.Insert(canv.Children.Count / 2, polyShadow);

            //Основная ломаная добавляется последней
            canv.Children.Add(polyStylus);

            CaptureStylus();
            isDrawing    = true;
            args.Handled = true;
        }
Exemple #8
0
        protected override void OnStylusDown(StylusDownEventArgs e)
        {
            base.OnStylusDown(e);

            // TJC: only take in stylus ink, not multitouch
            bool isStylus = e.StylusDevice.Id == MyRend.STYLUS_ID || e.StylusDevice.StylusButtons.Count == 2; // tip and barrel

            if (!isStylus)
            {
                _touchCount++;
                if (_touchCount > _maxTouches)
                {
                    _maxTouches = _touchCount;
                }
                //System.Console.WriteLine("DOWN TC: " + _touchCount + " " + _maxTouches);
                //if (_touchCount > 0) return; // don't capture ink if more than one touch // TJC TEST
            }

            if (InkEnabled)
            {
                _stylusPoints = new StylusPointCollection();
                // Capture the stylus so all stylus input is routed to this control.
                Stylus.Capture(this);
                _stylusPoints.Add(e.GetStylusPoints(this, _stylusPoints.Description));
            }
        }
        /// <summary>
        /// Occurs when the stylus is pressed down on the canvas
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void inkCanvas_StylusDown(object sender, StylusDownEventArgs e)
        {
            if (debug)
            {
                Console.WriteLine("Stylus Down " + sketchPanel.InkCanvas.GetSelectedStrokes().Count);
            }

            if (stylusOverWidget(e.GetPosition(sketchPanel.InkCanvas)))
            {
                return;
            }

            this.hoverTimer.Stop();
            if (widgetsShowing)
            {
                HideAllWidgets();
            }

            if (selectionActive && !editMenu.labelMenuIsOpen)
            {
                this.selector.InkCanvas_StylusDown(sender, e);
            }

            // Make sure we the wait cursor is turned off on the pen down
            sketchPanel.InkCanvas.UseCustomCursor = false;
        }
Exemple #10
0
        /// <summary>
        /// Brings up an editing box for recognized input/output names
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void header_StylusDown(object sender, StylusDownEventArgs e)
        {
            ReplaceNamesDialog replaceNamesDialog = new ReplaceNamesDialog(this.Headers);

            replaceNamesDialog.Show();
            replaceNamesDialog.ReplaceNames += new ReplaceNamesEventHandler(replaceNamesDialog_ReplaceNames);
        }
Exemple #11
0
    protected override void OnStylusDown(StylusDownEventArgs e)
    {
        base.OnStylusDown(e);
        StylusPointCollection points = e.GetStylusPoints(this);

        InitializeEraserHitTester(points);
    }
Exemple #12
0
        protected override void OnStylusDown(StylusDownEventArgs args)
        {
            base.OnStylusDown(args);
            Point ptStylus = args.GetPosition(canv);

            // Create a Polyline with rounded ends and joins for the foreground.
            polyStylus                    = new Polyline();
            polyStylus.Stroke             = brushStylus;
            polyStylus.StrokeThickness    = widthStroke;
            polyStylus.StrokeStartLineCap = PenLineCap.Round;
            polyStylus.StrokeEndLineCap   = PenLineCap.Round;
            polyStylus.StrokeLineJoin     = PenLineJoin.Round;
            polyStylus.Points             = new PointCollection();
            polyStylus.Points.Add(ptStylus);

            // Another Polyline for the shadow.
            polyShadow                    = new Polyline();
            polyShadow.Stroke             = brushShadow;
            polyShadow.StrokeThickness    = widthStroke;
            polyShadow.StrokeStartLineCap = PenLineCap.Round;
            polyShadow.StrokeEndLineCap   = PenLineCap.Round;
            polyShadow.StrokeLineJoin     = PenLineJoin.Round;
            polyShadow.Points             = new PointCollection();
            polyShadow.Points.Add(ptStylus + vectShadow);

            // Insert shadow before all foreground polylines.
            canv.Children.Insert(canv.Children.Count / 2, polyShadow);

            // Foreground can go at end.
            canv.Children.Add(polyStylus);

            CaptureStylus();
            isDrawing    = true;
            args.Handled = true;
        }
        /// <summary>
        /// Allows the user to connect shapes by dragging a connection
        /// Stylus down gets the endpoint that was clicked, stores it in clickedPoint.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void InkCanvas_StylusDown(object sender, StylusDownEventArgs e)
        {
            if (debug)
            {
                Console.WriteLine("Endpoint stylus down received.");
            }

            System.Windows.Point clickPoint = e.GetPosition(sketchPanel.InkCanvas);

            // Get the endpoint that was clicked
            foreach (EndPointPainter endPoint in endPointPainterMap.Values)
            {
                double distance = Math.Sqrt(Math.Pow(endPoint.InkPoint.X - clickPoint.X, 2) +
                                            Math.Pow(endPoint.InkPoint.Y - clickPoint.Y, 2));

                if (distance <= CLICK_RADIUS)
                {
                    clickedIndex = endPoint.Id;

                    EndPointPainter clickedPoint;
                    endPointPainterMap.TryGetValue((int)clickedIndex, out clickedPoint);

                    if (clickedPoint == null || clickedPoint.EPoint.IsConnected)
                    {
                        clickedIndex = null;
                        return;
                    }

                    sketchPanel.DisableDrawing();
                    break;
                }
            }
        }
Exemple #14
0
        private void DrawingCanvas_StylusDown(object sender, StylusDownEventArgs e)
        {
            stylusPoints = new StylusPointCollection();
            StylusPointCollection eventPoints =
                e.GetStylusPoints(this, stylusPoints.Description);

            stylusPoints.Add(eventPoints);
        }
Exemple #15
0
 /// <summary>
 /// All handlers for application stylus/touch/button logging
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void InkCanvas_StylusDown(object sender, StylusDownEventArgs e)
 {
     if (IsStylus(e))
     {
         currentApp.tabletState.Update("/input/stylus/surface/touch", true);
         GeneralStylusEventHandler(e);
     }
 }
Exemple #16
0
        protected override void OnStylusDown(StylusDownEventArgs e)
        {
            base.OnStylusDown(e);

            stylusPoints = new StylusPointCollection();

            stylusPoints.Add(e.GetStylusPoints(this, stylusPoints.Description));
        }
Exemple #17
0
 private void paintSurface_StylusDown(object sender, StylusDownEventArgs e)
 {
     if (!isMouseDown)
     {
         Debug.WriteLine("Mouse down from stylus down event: " + e.GetPosition(paintSurface).X + ", " + e.GetPosition(paintSurface).Y);
         MyMouseDown(e.GetPosition(paintSurface));
     }
 }
Exemple #18
0
        protected override void OnStylusDown(StylusDownEventArgs e)
        {
            Stylus.Capture(this);
            StylusPointCollection newStylusPoints = e.GetStylusPoints(this);

            stylusPoints = new StylusPointCollection(newStylusPoints.Description);
            stylusPoints.Add(newStylusPoints);
        }
        private void image1_StylusDown(object sender, StylusDownEventArgs e)
        {
            Point pt = e.GetPosition(image1);
            StylusPointCollection sp = e.GetStylusPoints(image1);

            DrawStart(pt, sp[0].PressureFactor);
            e.Handled = true;
        }
Exemple #20
0
        void button1_StylusDown(object sender, StylusDownEventArgs e)
        {
            // Notify base class of event
            base.OnStylusDown(e);

            // Display a message that the stylus is down
            textbox0.Text = "Stylus Down";
        }
 /// <summary>
 /// Event handler for the StylusDown event. Implements a zoom operation for a double tap.
 /// </summary>
 /// <param name="sender">Sender of the StylusDown event.</param>
 /// <param name="e">Event parameters.</param>
 void mapView_StylusDown(object sender, StylusDownEventArgs e)
 {
     if (e.TapCount == 2)
     {
         var p = MapView.CanvasToPtvMercator(MapView.GeoCanvas, e.GetPosition(MapView.GeoCanvas));
         MapView.ZoomAround(p, MapView.FinalZoom + 1, Map.UseAnimation);
         e.Handled = true;
     }
 }
Exemple #22
0
 void inqCanvas_PreviewStylusDown(object sender, StylusDownEventArgs e)
 {
     if (Selected.Contents != null && Selected.Contents.Outline != null && Selected.Contents.Outline.GetBounds().Contains(e.GetPosition(inqCanvas)))
     {
         StartMove(e.GetPosition(inqCanvas));
         inqCanvas.InkEnabled = false;
         e.Handled            = true;
     }
 }
 /// <summary>
 /// Invoked when an unhandled <see cref="E:System.Windows.Input.StylusDown" /> attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
 /// </summary>
 /// <param name="e">The <see cref="T:System.Windows.Input.StylusDownEventArgs" /> that contains the event data.
 protected override void OnStylusDown(StylusDownEventArgs e)
 {
     Focus();
     // Capture stylus so stylus events are still pushed to CEF even if the stylus leaves the control before a StylusUp.
     // This behavior is similar to how other browsers handle stylus input.
     CaptureStylus();
     OnStylus(e, TouchEventType.Pressed);
     base.OnStylusDown(e);
 }
Exemple #24
0
 private void OnStylusDown(object sender, StylusDownEventArgs e)
 {
     if (!this.IsTouchNavigationEnabled)
     {
         return;
     }
     _downPoints = e.GetStylusPoints(sender as IInputElement);
     this.ShowNavigationButtons = false;
 }
 private async void LessonContainer_StylusDown(object sender, StylusDownEventArgs e)
 {
     // If touch-and-hold (within 9px radius circle, over 700ms)
     if (await TouchHelper.StylusHold(e, LessonContainer, 700, 9))
     {
         // Opens RadialMenu
         LayerStackDC.OpenRadialMenu(LayerStackDC.Viewport.GetViewport(), e.GetPosition(LessonContainer),
                                     RadialMenuState.Levels.Main);
     }
 }
Exemple #26
0
        //private void StudentDynamicRenderer_NearestStylusPointCalculatedEvent(object sender, StudentDynamicRenderer.NearestExpertStylusPointCalculatedEventArgs e)
        //{
        //    ExpertVelocity = GetGuidValue(e.stroke, ExpertVelocity_Guid);
        //    Debug.WriteLine("Expert Velocity: " + ExpertVelocity);
        //}
        #endregion

        #region OverRides

        protected override void OnStylusDown(StylusDownEventArgs e)
        {
            cts = new CancellationTokenSource();
            //Add the initial time for the event
            myStrokeAttManager.StrokeTime.Add(e.Timestamp);
            //raise an event to let expert inkcanvas know that the pen is down
            //PenDownUpEventEventArgs args = new PenDownUpEventEventArgs();
            //args.IsPenDown = true;
            //OnPenDownUpEvent(args);
            base.OnStylusDown(e);
        }
Exemple #27
0
        protected override void OnStylusDown(StylusDownEventArgs e)
        {
            base.OnStylusDown(e);

            StylusPointCollection eventPoints = e.GetStylusPoints(this);

            // Create a new StylusPointCollection using the StylusPointDescription
            // from the stylus points in the StylusDownEventArgs.
            stylusPoints = new StylusPointCollection(eventPoints.Description, eventPoints.Count);
            stylusPoints.Add(eventPoints);
        }
        void TouchWindow_PreviewStylusDown(object sender, StylusDownEventArgs e)
        {
            var touchPointSize = TouchDetector.GetSizeFromStylusPoint(e.StylusDevice.GetStylusPoints(this)[0]);

            var touchPoint = new GestureTouchPoint(e.StylusDevice, touchPointSize, e.GetPosition(this), TouchAction.Down);

            _touches.AddOrUpdate(e.StylusDevice.Id, touchPoint,
                                 (key, oldValue) => touchPoint);

            GestureTouchDown(this, new GestureTouchEventArgs(e.StylusDevice.Id, touchPoint, e.Timestamp));
        }
Exemple #29
0
        protected override void OnPreviewStylusDown(StylusDownEventArgs e)
        {
            if (SetValueStartDrag(
                    x => e.GetPosition(x),
                    x => x.CaptureStylus()))
            {
                e.Handled = true;
            }

            base.OnPreviewStylusDown(e);
        }
Exemple #30
0
        //</Snippet5>

        //<Snippet6>

        //<Snippet4>
        // Prepare to collect stylus packets. Get the
        // IncrementalHitTester from the InkPresenter's
        // StrokeCollection and subscribe to its StrokeHitChanged event.
        protected override void OnStylusDown(StylusDownEventArgs e)
        {
            base.OnStylusDown(e);

            EllipseStylusShape eraserTip = new EllipseStylusShape(3, 3, 0);

            eraseTester =
                presenter.Strokes.GetIncrementalStrokeHitTester(eraserTip);
            eraseTester.StrokeHit += new StrokeHitEventHandler(eraseTester_StrokeHit);
            eraseTester.AddPoints(e.GetStylusPoints(this));
        }