Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Non-square shapes (Read 2754 times)
Kevin Wienhold
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Sep 18th, 2012
Non-square shapes
Sep 18th, 2012 at 11:32am
Print Post  
I have been using the ShapeDesigner sample to create custom shapes to use in my software.
Unfortunately it does not appear possible to create shapes of differing height and width.
After searching the forums here I came across a thread from 2007 that stated that this was indeed not possible and offered the source code to the ShapeDesigner to allow the poster to make the alterations himself.
Seeing that the sourcecode posted in that thread is outdated, I was wondering if
a) creating non-square shapes is now inherently supported and I just missed it
or
b) an updated version of the sourcecode is available to make the necessary changes myself?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Non-square shapes
Reply #1 - Sep 18th, 2012 at 12:26pm
Print Post  
What do you mean by differing height and width? The width and height of a node are independent from the shape elements, and the shape is stretched to fill the node. I.e. the elements' coordinates are defined as percents of the nodes' bounding rectangle, so the shape might be a [0-100,0-100] square, but when applied to a node with a 100x50 bounding rectangle, it will appear as a 100x50 rectangle in the diagram rather than a 100x100 one.

If you need shape elements to not scale uniformly, check "formula shapes", where you define shapes using scripts. I think these were released after 2007 and might have been added to implement what was discussed in the thread you mention.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Kevin Wienhold
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Sep 18th, 2012
Re: Non-square shapes
Reply #2 - Sep 18th, 2012 at 1:26pm
Print Post  
If you create a shape in the shape editor that is twice as wide as it is high (a rectangle that only covers the upper half of the grid, for example) and apply this shape to a node, only the node's upper half will be visible (because, as you say, the shape gets scaled to the node's size).
Handles, Anchor Points etc. still refer to the node's bounds though, meaning that connections attach to the node at a point that (for the user) appears to be some distance away from it.
So, fitting a 100x100 shape into a 100x50 node works fine, but fitting a 100x50 shape into any node does not, since MindFusion appearantly considers all shapes to be square, so my 100x50 shape is actually a 100x100 shape, just with the bottom half left empty.
I could of course design the shapes to be 100x100 and apply them to 100x50 nodes, but since the symbols I am trying to represent in the shapes contain text, this would lead to them looking warped unless I somehow managed to design them at a precise 2:1 vertical scale.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Non-square shapes
Reply #3 - Sep 18th, 2012 at 1:52pm
Print Post  
Quote:
fitting a 100x50 shape into any node does not, since MindFusion appearantly considers all shapes to be square, so my 100x50 shape is actually a 100x100 shape, just with the bottom half left empty.


I think this works exactly as designed; e.g. that's what lets you create shapes like the Delay symbol, where half the shape is a rectangle and the rest is an ellipse, and the whole symbol scales to fit the node's area.

I suppose in your case you shouldn't be using custom shapes at all, but keep the standard rectangle and set node.Bounds accordingly once the shape is dropped on the diagram's canvas.

If you need to show rectangles of varying proportions in a listbox kind of interface, try copying the custom drawn listbox from the flowcharter sample project and modify it - instead of drawing nodes with different shapes, draw only rectangular nodes but with different Bounds. Then handle the DragDrop event accordingly to set the Bounds of the newly created nodes to the required Width/Height.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Kevin Wienhold
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Sep 18th, 2012
Re: Non-square shapes
Reply #4 - Sep 19th, 2012 at 6:12am
Print Post  
I think I'll just go with pictures of each symbol on default rectangular nodes and adjust the bounds according to the size of the images.
Thank you for taking the time to clear this up.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Non-square shapes
Reply #5 - Sep 19th, 2012 at 7:58am
Print Post  
If your aim is to display some symbol that does not scale together with the rectangle, you could implement that with formula shapes, though there is no support for them in the editor yet. Another option could be showing the symbols as content of SvgNodes, with ContentAlign set to e.g. Fit or TopLeft.

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