Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic The diagram overflows outside canvas (Read 2748 times)
Santosh
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 28
Joined: Mar 25th, 2015
The diagram overflows outside canvas
Oct 5th, 2015 at 6:10am
Print Post  
On expanding nodes, the diagram overflows canvas, and some of the diagram is not visible.

Diagram 1 below represents the diagram on page load
Diagram 2 represents the diagram when all nodes are expanded

In Diagram 2, the nodes overflow the canvas
  

Load1_001.png ( 28 KB | 85 Downloads )
Load1_001.png
Load2_001.png ( 49 KB | 105 Downloads )
Load2_001.png
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: The diagram overflows outside canvas
Reply #1 - Oct 5th, 2015 at 8:57am
Print Post  
Try resizing it from treeExpanded event handler:

Code
Select All
diagram.addEventListener(Events.treeExpanded, onTreeExpanded);

function onTreeExpanded(sender, args)
{
	var diagram = sender;
	var margin = 10;

	var contentRect = diagram.getContentBounds();
	var diagRect = diagram.getBounds();

	if (contentRect.bottom() > diagRect.bottom() ||
		contentRect.right() > diagRect.right())
	{
		diagram.setBounds(
			diagRect.union(contentRect.inflate(margin)));
	}
} 



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


I Love MindFusion!

Posts: 28
Joined: Mar 25th, 2015
Re: The diagram overflows outside canvas
Reply #2 - Oct 5th, 2015 at 9:31am
Print Post  
Hi Stoyo,

The above code creates some overlaping between the nodes
  

Load3.png ( 56 KB | 95 Downloads )
Load3.png
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: The diagram overflows outside canvas
Reply #3 - Oct 5th, 2015 at 9:37am
Print Post  
The above code doesn't touch nodes at all. Perhaps you already had a treeExpanded handler that applies TreeLayout and that new method replaces it? In such case copy only the function body to your existing handler, appending to TreeLayout code.
  
Back to top
 
IP Logged
 
Santosh
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 28
Joined: Mar 25th, 2015
Re: The diagram overflows outside canvas
Reply #4 - Oct 5th, 2015 at 10:01am
Print Post  
Thanks Stoyo...that helped Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint