/// <summary> /// Converts the given rectangle from the view into the world coordinate space. /// </summary> internal static RectD IntermediateToWorldCoordinates(CanvasControl canvas, RectD rect) { var p1 = GetRounded(canvas.IntermediateToWorldCoordinates(rect.GetTopLeft())); var p2 = GetRounded(canvas.IntermediateToWorldCoordinates(rect.GetBottomRight())); return(new RectD(p1.X, p1.Y, (int)Math.Max(0, p2.X - p1.X), (int)Math.Max(0, p2.Y - p1.Y))); }
protected override GeneralPath GetOutline(INode node) { double size = Math.Min(node.Layout.Width, node.Layout.Height); RectD bounds = new RectD(node.Layout.GetCenter().X - size / 2, node.Layout.GetCenter().Y - size / 2, size, size); var path = new GeneralPath(); path.AppendEllipse(new RectD(bounds.GetTopLeft(), bounds.GetSize()), false); return(path); }
private static void DrawTrimmedString(IRenderContext context, VisualGroup group, string text, Font font, Brush brush, RectD box) { if (!box.IsEmpty) { group.Add(new TextVisual { Text = text, Font = font, Format = new StringFormat { Trimming = StringTrimming.EllipsisCharacter }, Brush = brush, Location = box.GetTopLeft() }); } }
protected override GeneralPath GetOutline(INode node) { double width = Math.Min(node.Layout.Width, node.Layout.Height / BpmnConstants.ConversationWidthHeightRatio); double height = width * BpmnConstants.ConversationWidthHeightRatio; RectD bounds = new RectD(node.Layout.GetCenter().X - width / 2, node.Layout.GetCenter().Y - height / 2, width, height); var path = new GeneralPath(); path.MoveTo(0, 0.5); path.LineTo(0.25, 0); path.LineTo(0.75, 0); path.LineTo(1, 0.5); path.LineTo(0.75, 1); path.LineTo(0.25, 1); path.Close(); var transform = new Matrix2D(); transform.Translate(bounds.GetTopLeft()); transform.Scale(bounds.Width, bounds.Height); path.Transform(transform); return(path); }
protected override void CollectGridSnapResults(GraphSnapContext context, CollectSnapResultsEventArgs args, RectD suggestedLayout, INode node) { AddGridSnapResult(context, args, suggestedLayout.GetTopLeft(), node); }