public void StartManip(Point p, object sender) { CurrentPoint = p; double d1 = ShapeUtils.Dist(p, new Point(line.X1, line.Y1)); double d2 = ShapeUtils.Dist(p, new Point(line.X2, line.Y2)); double dc = ShapeUtils.Dist(p, new Point((line.X1 + line.X2) / 2, (line.Y1 + line.Y2) / 2)); double dMin = ShapeUtils.Min(d1, d2, dc); if (dMin == d1) { markerSide = VdSegmentUtil.SegmentMarker.Side1; } else if (dMin == dc) { markerSide = VdSegmentUtil.SegmentMarker.Center; } else if (dMin == d2) { markerSide = VdSegmentUtil.SegmentMarker.Side2; } activeMarker = null; if (markerSide == VdSegmentUtil.SegmentMarker.Side1) { activeMarker = selMarker1; activeMarker.CaptureMouse(); } else if (markerSide == VdSegmentUtil.SegmentMarker.Side2) { activeMarker = selMarker2; activeMarker.CaptureMouse(); } }
public double distToFigure(Point from) { var d1 = ShapeUtils.Dist(new Point(line.X1, line.Y1), from); var d2 = ShapeUtils.Dist(new Point(line.X2, line.Y2), from); var d3 = ShapeUtils.Dist(new Point((line.X1 + line.X2) / 2, (line.Y1 + line.Y2) / 2), from); return(ShapeUtils.Min(d1, d2, d3)); }
public double distToFigure(Point from) { var right = _left + _badge.ActualWidth; var bottom = _top + _badge.ActualHeight; var d1 = ShapeUtils.Dist(new Point(_left, _top), from); var d2 = ShapeUtils.Dist(new Point(_left, bottom), from); var d3 = ShapeUtils.Dist(new Point(right, bottom), from); var d4 = ShapeUtils.Dist(new Point(right, _top), from); return(ShapeUtils.Min(d1, d2, d3, d4)); }
public double distToFigure(Point from) { var d1 = ShapeUtils.Dist(_bounds.TopLeft, from); var d2 = ShapeUtils.Dist(_bounds.TopRight, from); var d3 = ShapeUtils.Dist(_bounds.BottomLeft, from); var d4 = ShapeUtils.Dist(_bounds.BottomRight, from); var cx = (_bounds.Left + _bounds.Right) / 2; var cy = (_bounds.Top + _bounds.Bottom) / 2; var d5 = ShapeUtils.Dist(new Point(cx, cy), from); return(Math.Min(ShapeUtils.Min(d1, d2, d3, d4), d5)); }
double IVdShape.distToFigure(Point from) { if (bezierBorder == null) { return(double.MaxValue); } if (bezierBorder.Data == null) { return(double.MaxValue); } var center = new Point(bezierBorder.Data.Bounds.X + bezierBorder.Data.Bounds.Width / 2, bezierBorder.Data.Bounds.Y + bezierBorder.Data.Bounds.Height / 2); return(ShapeUtils.Dist(from, center)); }
public double distToFigure(Point from) { HitTestResult htr = VisualTreeHelper.HitTest(_textEnterUC.handle, from); if (htr != null) { var border = htr.VisualHit as Border; if (border != null) { return(0); } } var Org = _textEnterUC.txtLabel.TranslatePoint(new Point(0, 0), _scene); var w = _textEnterUC.txtLabel.ActualWidth; var h = _textEnterUC.txtLabel.ActualHeight; var TopRight = new Point(Org.X + w, Org.Y); var BottomRight = new Point(Org.X + w, Org.Y + h); var BottomLeft = new Point(Org.X, Org.Y + h); var Center = new Point(Org.X + w / 2, Org.Y + h / 2); double d1 = ShapeUtils.Dist(Org, from); double d2 = ShapeUtils.Dist(TopRight, from); double d3 = ShapeUtils.Dist(BottomRight, from); double d4 = ShapeUtils.Dist(BottomLeft, from); double d5 = ShapeUtils.Dist(Center, from); double dMin = ShapeUtils.Min(d1, d2, d3); dMin = ShapeUtils.Min(dMin, d4, d5); if (dMin > 270) { dMin = double.MaxValue; } return(dMin); }