Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Shape templates with fixed points (Read 1685 times)
jf2020
Junior Member
**
Offline


I love FlowChart!

Posts: 63
Joined: Feb 23rd, 2006
Shape templates with fixed points
Feb 15th, 2011 at 6:59am
Print Post  
Hi,

We are providing our users the possibility to add various shapes to their diagram like arrows. However the most common complaint is that they just look ugly. The reason is that when you resize the arrow everything gets scaled including the head of the arrow. What they want is the same behaviour as for autoshapes in PowerPoint or Visio, i.e. the head of the arrow keeps a fixed size when resizing the arrow (unless the size of the bounding box is too small at which point you also start resizing the head).  As templates use percentages to define points, I have implemented a small function that dynamically creates a new shape with the correct percentages each time the node is resized and sets it as teh current shape template of that node.  This works, however it seems a bit ugly and it would be nice to have that as a core feature of FlowChart. I'm a bit surprised that it does not exist yet so maybe I completely missed something?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Shape templates with fixed points
Reply #1 - Feb 15th, 2011 at 7:54am
Print Post  
Hi,

In Visio such shapes are defined via parameterized formulas that calculate point coordinates depending on the shape's width an height. We have a small script interpreter in the mindfusion.reporting tool that should be capable of parsing such formulas; we will try to integrate it into the flowchart control to allow creating dynamic shapes.

Stoyan
  
Back to top
 
IP Logged
 
jf2020
Junior Member
**
Offline


I love FlowChart!

Posts: 63
Joined: Feb 23rd, 2006
Re: Shape templates with fixed points
Reply #2 - Feb 15th, 2011 at 8:36am
Print Post  
Stoyan,

That would be wonderful.  Let me know when you have a beta version ready for testing  Wink

Jean-Francois
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Shape templates with fixed points
Reply #3 - Mar 29th, 2011 at 12:54pm
Print Post  
Hi,

Here is the beta:
https://mindfusion.eu/_beta/fcnet562_formula_shapes.zip

It lets you pass Visio-like shape formulas to the Shape constructor:

Code
Select All
string outline = @"
	my = Height / 2;
	ah = Min(10, Height / 4);
	aw = Min(20, Width / 2);
	MoveTo(0, my - ah);
	LineTo(Width - aw, my - ah);
	LineTo(Width - aw, 0);
	LineTo(Width, my);
	LineTo(Width - aw, Height);
	LineTo(Width - aw, my + ah);
	LineTo(0, my + ah);
	";
Shape shape = new Shape(outline, "test");
diagram.DefaultShape = shape;
 



The sample above create an arrow shape with fixed shaft width and arrowhead length, which will still shrink when the node gets small due to the Min calls.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint