private void OnShaftPoint2Changed(object sender, PointChangedEventArgs e)
 {
     if (_enablePointChangeEvents)
     {
         EventsHelper.Fire(_endPointChanged, this, new PointChangedEventArgs(e.Point, e.CoordinateSystem));
     }
 }
 private void _lineGraphic_Point1Changed(object sender, PointChangedEventArgs e)
 {
     if (_enableInternalEvent && _pointCount > 0)
     {
         this.NotifyPointChanged(0);
     }
 }
Example #3
0
 protected virtual void Line_PointChanged(object sender, PointChangedEventArgs e)
 {
     ResizeHandles.ForEach(h => h.Dispose());
     ResizeHandles.Clear();
     InitializeResizeHandle(provider);
     IsGraphicsPathChanged = true;
 }
 private void OnSubjectPoint2Changed(object sender, PointChangedEventArgs e)
 {
     this.SuspendControlPointEvents();
     this.CoordinateSystem = CoordinateSystem.Source;
     try
     {
         this.ControlPoints[1] = this.Subject.Point2;
     }
     finally
     {
         this.ResetCoordinateSystem();
         this.ResumeControlPointEvents();
     }
 }
 private void OnSubjectBottomRightChanged(object sender, PointChangedEventArgs e)
 {
     this.SuspendControlPointEvents();
     this.CoordinateSystem = CoordinateSystem.Source;
     try
     {
         RectangleF rect = this.Subject.Rectangle;
         this[_topRight]    = new PointF(rect.Right, rect.Top);
         this[_bottomRight] = new PointF(rect.Right, rect.Bottom);
         this[_bottomLeft]  = new PointF(rect.Left, rect.Bottom);
     }
     finally
     {
         this.ResetCoordinateSystem();
         this.ResumeControlPointEvents();
     }
 }
 private void OnSubjectChanged(object sender, PointChangedEventArgs e)
 {
     this.SuspendControlPointEvents();
     this.CoordinateSystem = CoordinateSystem.Source;
     try
     {
         RectangleF rect       = this.Subject.Rectangle;
         float      halfWidth  = rect.Width / 2;
         float      halfHeight = rect.Height / 2;
         this[_top]    = new PointF(rect.Left + halfWidth, rect.Top);
         this[_bottom] = new PointF(rect.Left + halfWidth, rect.Bottom);
         this[_left]   = new PointF(rect.Left, rect.Top + halfHeight);
         this[_right]  = new PointF(rect.Right, rect.Top + halfHeight);
     }
     finally
     {
         this.ResetCoordinateSystem();
         this.ResumeControlPointEvents();
     }
 }
Example #7
0
 /// <summary>
 /// Invoked when a point has changed.
 /// </summary>
 /// <param name="source">The source of the event.</param>
 /// <param name="args">The event arguments.</param>
 void OnPointChanged(Point2D source, PointChangedEventArgs args)
 {
     OnChanged();
 }
Example #8
0
        /// <summary>
        /// Invoked when a dependent point has changed in order
        /// to update the dependency.
        /// </summary>
        /// <param name="source">The source of the change.</param>
        /// <param name="args">The event arguments.</param>
        void OnDependentPointChanged(TouchPoint source, PointChangedEventArgs args)
        {
            Point oldPosition = this._position;
            Point newPosition = new Point(oldPosition.X + args.DeltaX, oldPosition.Y + args.DeltaY);

            //this.X = this.X + args.DeltaX;
            //this.Y = this.Y + args.DeltaY;

            this._position = newPosition;
            OnPropertyChanged(() => X);
            OnPropertyChanged(() => Y);
            OnChanged(oldPosition, newPosition);
        }
        /// <summary>
        /// Invoked when a point has changed.
        /// </summary>
        /// <param name="source">The source of the change.</param>
        /// <param name="args">The event arguments.</param>
        private void OnPointChanged(TouchPoint source, PointChangedEventArgs args)
        {
            // Manually update the disconnected point
            var disconnectedPoint = DisconnectedPoint;

            // Check whether the disconnectedPoint is not the source of the event, as the event will be raised when the point has just been disconnected.
            // Furthermore, we need two touch points to update the third disconnected point.
            if (disconnectedPoint != null && disconnectedPoint != source)
            {
                // We need to update one of the other two points that define the bottom line of the tangible object.
                // One of the known touch points is the source.
                // Now we need to find the other touch point that has contact.
                var knownPoint = Points.Single(p => p != source && p != disconnectedPoint);

                Windows.Foundation.Point reconstructedPoint;
                Tuple<Windows.Foundation.Point, Windows.Foundation.Point> reconstructedPoints;

                if (source.IsDirectionPoint)
                {
                    // We know the direction point (source) and one of the points from the bottom line (knownPoint).
                    // As both points are symmetric we only need to consider one case.
                    reconstructedPoints = MathHelper.GetThirdPointOfTriangle(source, knownPoint, DistanceToDirectionPoint, BottomLineLength);
                }
                else
                {
                    // We have one known point from the bottom line and the direction point.
                    if (disconnectedPoint.IsDirectionPoint)
                    {
                        // We know the points from the bottom line (source, knownPoint).
                        // We search for the direction point.
                        reconstructedPoints = MathHelper.GetThirdPointOfTriangle(source, knownPoint, DistanceToDirectionPoint, DistanceToDirectionPoint);
                    }
                    else
                    {
                        // We know one point from the bottom line (source) and the direction point (knownPoint)
                        reconstructedPoints = MathHelper.GetThirdPointOfTriangle(source, knownPoint, BottomLineLength, DistanceToDirectionPoint);
                    }
                }

                // As we have two solutions, we need the one that is closer to the previous value
                // of the disconnected point.
                reconstructedPoint = new List<Windows.Foundation.Point>()
                    {
                        reconstructedPoints.Item1, reconstructedPoints.Item2
                    }.MinDistanceTo(disconnectedPoint);

                // Update the disconnected point.
                // NOT WORKING !!!
                // disconnectedPoint.UpdateDisconnectedPoint(reconstructedPoint.X, reconstructedPoint.Y);
            }

            // Update the top line.
            var directionPoint = Points.Single(p => p.IsDirectionPoint);
            var bottomLinePoints = Points.Where(p => !p.IsDirectionPoint).ToArray();
            if (bottomLinePoints.Count() > 2)
                throw new InvalidOperationException("The tangible object has unsufficient points.");

            var topLine = CalculateTopLine(bottomLinePoints[0], bottomLinePoints[1], directionPoint);

            _topLine.Update(topLine);
        }