I have a question about designing custom shapes for nodes.
I've attached an image that should appear at the bottom of this post. The image demonstrates that shape I am attempting to achieve, and what I have been able to get so far with my code.
Here is my code for my custom node:
public class AddNode : MindFusion.Diagramming.ShapeNode
{
public AddNode(Diagram parent_diagram) : base(parent_diagram)
{
AnchorPoint input_x = new AnchorPoint(0, 33, true, false);
AnchorPoint input_y = new AnchorPoint(0, 66, true, false);
AnchorPoint output = new AnchorPoint(100, 50, false, true);
AnchorPattern = new AnchorPattern()
{
Points = new AnchorPointCollection()
{
input_x,
input_y,
output
}
};
Shape = new Shape(
new MindFusion.Diagramming.ElementTemplate[]
{
new LineTemplate(0, 0, 0, 100),
new LineTemplate(0, 100, 100, 50),
new LineTemplate(100, 50, 0, 0)
},
FillMode.Winding
);
}
}
This code creates a triangle that is too elongated in the horizontal direction. If I replace the shape code with this:
Shape = new Shape(
new MindFusion.Diagramming.ElementTemplate[]
{
new LineTemplate(0, 0, 0, 100),
new LineTemplate(0, 100, 75, 50),
new LineTemplate(75, 50, 0, 0)
},
FillMode.Winding
);
Then the triangle is about the right shape, but the AnchorPoint is offset.
What are the units being used here? Why does "100" in the vertical direction equate to 3 grid boxes on the diagram, whereas "100" in the horizontal direction equates to 4 grid boxes on the diagram?
For what it's worth, on my diagram I set GridSizeX and GridSizeY to both be 10, if that is important.