Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Version 3.4 beta (Read 1098 times)
Forum Admin
YaBB Administrator
*****
Offline


Rock and Roll

Posts: 689
Joined: Apr 6th, 2003
Version 3.4 beta
Feb 2nd, 2016 at 12:21pm
Print Post  
WpfDiagram version 3.4 contains the following new features and bug-fixes:

Free-form nodes
A FreeFormNode collects all points from users' mouse or touch input and displays them as node's outline. To let users draw free-form nodes interactively, set Diagram.Behavior to DrawFreeForms or LinkFreeForms. Use the Points property of FreeFormNode to get or set outline points programmatically. If the Closed property is set, the node is drawn as a closed shape and its interior filled, or otherwise the node is drawn as a poly-line. If the distance between first and last points drawn by user is shorter than Diagram.AutoCloseDistance, the node's Closed property is automatically set to true. AutoCloseDistance default value is Double.MaxValue, so free-form nodes are always closed.

Additional drawing modes, convenient for touch input, convert FreeFormNode objects drawn by user to ShapeNode objects with most similar shape. To enable them, set Behavior to DrawFreeShapes or LinkFreeShapes. The shapes against which the user's input is matched are set via diagram's FreeFormTargets property. By default it contains Rectangle, Decision and Ellipse shapes.



Shape control points
Shape formulas can now be parameterized by associating control points with Shape objects. Each control point is passed to the shape script as a named variable. Apart from the name, you can specify the default, min and max coordinates for each parameter via the ShapeControlPoint constructor, and whether to treat its values as percents or fixed offset.

For example, the following code creates an arrow shape with adjustable arrowhead and fletching sizes:
Code
Select All
string arrow60deg = @"
	x1 = p1.X;
	y1 = p1.Y;
	x2 = IIf(Width>=2*Height,0.5*Height*Tan(PI/6), 0.15*Width);
	x3 = IIf(Width>=2*Height, Height/4, 0.15*Width);
	MoveTo(0, Height * 0.5);
	LineTo(x1 , Height);
	LineTo(x1, Height - y1);
	LineTo(Width -x3 -x2 -x2, Height - y1);
	LineTo(Width -x3 -x2, Height);
	LineTo(Width, Height);
	LineTo(Width * p2.X / 100, Height * p2.Y / 100);
	LineTo(Width, 0);
	LineTo(Width - x3 -x2, 0);
	LineTo(Width -x3 -x2 -x2, y1);
	LineTo(x1, y1);
	LineTo(x1, 0);
	LineTo(0, Height * 0.5);
 ";

diagram.DefaultShape = new Shape(arrow60deg, "", new List<ShapeControlPoint>
{
	new ShapeControlPoint("p1",
		20, 0, -10, UnitType.Fixed,
		20, 0, 100, UnitType.Fixed) { MaxXRelativeToWidth = true },
	new ShapeControlPoint("p2",
		80, 60, 100, UnitType.Percentage,
		50, 50, -50, UnitType.Percentage) { MaxYRelativeToHeight = true }
},
	"arrow60deg"); 





Miscellaneous
~ Undo/redo records for in-place edit operations are now created automatically. They are represented by instances of the EditTextCmd class.
~ LinkTextStyle.Center improved for vertical links.
~ fixed a bug where link to a child node inside a nested container would not point to correct position if both nested and outer containers are folded.

API changes
Adjustment handles are no longer identified by integer values but by instances of AdjustmentHandle and derived classes. This changes the signatures of DiagramItem.HitTestHandle methods and the InteractionState constructor. Standard handle classes included are NodeAdjustmentHandle for changing a node's position and size, LinkAdjustmentHandle for changing link control point positions, ShapeAdjustmentHandle for adjusting shape formula parameters, and FreeFormHandle for changing the position of a FreeFormNode outline point.

If anyone is interested in trying the beta version, please download this archive containing updated assembly files:
https://mindfusion.eu/_beta/wpfdiag34.zip

Any comments, questions and general feedback are welcome.
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint