public override Visual CreateVisual(IRenderContext context) { collapsedIcon.SetBounds(new RectD(PointD.Origin, Bounds.GetSize())); expandedIcon.SetBounds(new RectD(PointD.Origin, Bounds.GetSize())); var button = CreateButton(context, node, collapsedIcon.CreateVisual(context), expandedIcon.CreateVisual(context)); button.SetCanvasArrangeRect(Bounds.ToRectD()); return(button); }
/// <summary> /// This method is called by the framework to create a <see cref="IVisual"/> /// that will be included into the <see cref="IRenderContext"/>. /// </summary> /// <param name="context">The context that describes where the visual will be used.</param> /// <returns> /// The arrow visual to include in the canvas object visual tree./>. /// </returns> /// <seealso cref="UpdateVisual"/> IVisual IVisualCreator.CreateVisual(IRenderContext context) { icon.SetBounds(new RectD(-Bounds.Width, -Bounds.Height / 2, Bounds.Width, Bounds.Height)); var visualGroup = new VisualGroup(); visualGroup.Add(icon.CreateVisual(context)); // Rotate arrow and move it to correct position visualGroup.Transform = new Matrix((float)direction.X, (float)direction.Y, (float)-direction.Y, (float)direction.X, (float)anchor.X, (float)anchor.Y); return(visualGroup); }
public override IVisual CreateVisual(IRenderContext context) { collapsedIcon.SetBounds(new RectD(Bounds.GetTopLeft(), Bounds.GetSize())); expandedIcon.SetBounds(new RectD(Bounds.GetTopLeft(), Bounds.GetSize())); bool expanded = true; CanvasControl canvas = context != null ? context.CanvasControl : null; if (canvas != null) { IGraph graph = canvas.Lookup(typeof(IGraph)) as IGraph; if (graph != null) { IFoldingView foldedGraph = graph.Lookup <IFoldingView>(); if (foldedGraph != null && foldedGraph.Graph.Contains(node)) { expanded = foldedGraph.IsExpanded(node); } } } return(expanded ? expandedIcon.CreateVisual(context) : collapsedIcon.CreateVisual(context)); }
public virtual void SetBounds(IRectangle bounds) { dummyNode.Layout = bounds; innerIcon.SetBounds(placementParameter.Model.GetGeometry(dummyLabel, placementParameter).GetBounds()); }