Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic set minimum node size (Read 2155 times)
tmtton
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 39
Joined: May 9th, 2008
set minimum node size
May 23rd, 2008 at 8:34pm
Print Post  
ShapeNode's resizeToFitText(FitSize.KeepRatio) does resize the node to fit the text as expected. But in some cases, the node is resized too small (just enough to fit the wrapped-around text, for example). In JDiagram 2, is it possible to specify a node minimum size -- enlarge when necessary, but no smaller than a pre-defined size?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: set minimum node size
Reply #1 - May 24th, 2008 at 9:25am
Print Post  
You could apply the minimum size after calling resizeToFitText:

Code
Select All
public void resizeToFitText(ShapeNode node, Dimension2D minSize)
{
	node.resizeToFitText(FitSize.KeepRatio);

	Rectangle2D bounds = node.getBounds();
	bounds.add(
		bounds.getX() + minSize.getWidth(),
		bounds.getY() + minSize.getHeight());

	if (!node.getBounds().contains(bounds))
		node.setBounds(bounds);
}
 



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