public static void DrawAdorner(DrawingContext drawingContext, Point anchorPoint, EdgeFlags edgeFlags, Matrix matrix, Brush brush, Rect bounds) { Size ofTransformedRect = Adorner.GetSizeOfTransformedRect(bounds, matrix); if ((edgeFlags == EdgeFlags.Top || edgeFlags == EdgeFlags.Bottom) && (ofTransformedRect.Width < RotateAdornerHelper.Radius * 2.0 || ofTransformedRect.Height < SizeAdorner.Size) || (edgeFlags == EdgeFlags.Left || edgeFlags == EdgeFlags.Right) && (ofTransformedRect.Height < RotateAdornerHelper.Radius * 2.0 || ofTransformedRect.Width < SizeAdorner.Size) || (edgeFlags == EdgeFlags.TopLeft || edgeFlags == EdgeFlags.TopRight || (edgeFlags == EdgeFlags.BottomLeft || edgeFlags == EdgeFlags.BottomRight)) && (ofTransformedRect.Width < SizeAdorner.Size && ofTransformedRect.Height < SizeAdorner.Size)) { return; } RotateAdornerHelper.DrawAdorner(drawingContext, anchorPoint, edgeFlags, matrix, brush); }
public override void Draw(DrawingContext ctx, Matrix matrix) { Size ofTransformedRect = Adorner.GetSizeOfTransformedRect(this.ElementBounds, matrix); if (!this.ElementSet.AdornsMultipleElements && !this.shouldDrawSingleElementAdorner || (ofTransformedRect.Width < 10.0 || ofTransformedRect.Height < 10.0)) { return; } Point clickablePoint = this.GetClickablePoint(matrix); Brush brush = this.IsActive ? this.ActiveBrush : this.InactiveBrush; ctx.DrawEllipse(brush, this.ThinPen, clickablePoint, 2.5, 2.5); }
public static bool SkipAdorner(EdgeFlags edgeFlags, Matrix matrix, Rect bounds) { System.Windows.Size ofTransformedRect = Adorner.GetSizeOfTransformedRect(bounds, matrix); double num1 = 5.0; double num2 = 12.5; if (ofTransformedRect.Width < num1 && ofTransformedRect.Height < num1) { if (edgeFlags != EdgeFlags.BottomRight) { return(true); } } else if (edgeFlags != EdgeFlags.Top && edgeFlags != EdgeFlags.Bottom && (edgeFlags != EdgeFlags.Right && ofTransformedRect.Width < num1) || edgeFlags != EdgeFlags.Left && edgeFlags != EdgeFlags.Right && (edgeFlags != EdgeFlags.Bottom && ofTransformedRect.Height < num1) || ((edgeFlags == EdgeFlags.Top || edgeFlags == EdgeFlags.Bottom) && (ofTransformedRect.Width < num2 && ofTransformedRect.Width >= num1) || (edgeFlags == EdgeFlags.Left || edgeFlags == EdgeFlags.Right) && (ofTransformedRect.Height < num2 && ofTransformedRect.Height >= num1))) { return(true); } return(false); }
public override void Draw(DrawingContext context, Matrix matrix) { if (!this.shouldDraw || !PlatformTypes.Rectangle.IsAssignableFrom((ITypeId)this.Element.Type)) { return; } Size ofTransformedRect = Adorner.GetSizeOfTransformedRect(this.ElementBounds, matrix); if (ofTransformedRect.Width < 5.0 || ofTransformedRect.Height < 5.0) { return; } Point clickablePoint = this.GetClickablePoint(matrix); Point point = new Point(this.EffectiveRadiusX, this.EffectiveRadiusY) * matrix; Pen pen = this.ThinPen; if (VectorUtilities.SquaredDistance(clickablePoint, point) < 10000000000.0) { pen = pen.Clone(); pen.DashStyle = RoundedRectangleAdorner.dashStyle; pen.Freeze(); } context.DrawLine(pen, point, clickablePoint); Vector vector1 = RoundedRectangleAdorner.radius * this.NormalDirection; Vector vector2 = new Vector(vector1.Y, -vector1.X); StreamGeometry streamGeometry = new StreamGeometry(); StreamGeometryContext streamGeometryContext = streamGeometry.Open(); streamGeometryContext.BeginFigure(clickablePoint + vector1, true, true); streamGeometryContext.PolyLineTo((IList <Point>) new Point[3] { clickablePoint + vector2, clickablePoint - vector1, clickablePoint - vector2 }, 1 != 0, 0 != 0); streamGeometryContext.Close(); streamGeometry.Freeze(); Brush brush = this.IsActive ? this.ActiveBrush : this.InactiveBrush; context.DrawGeometry(brush, this.ThinPen, (System.Windows.Media.Geometry)streamGeometry); }