Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Restrict the nodes from moving outside the diagram canvas (Read 1757 times)
Kiran B
Full Member
***
Offline


I Love MindFusion!

Posts: 102
Joined: Apr 19th, 2013
Restrict the nodes from moving outside the diagram canvas
Apr 23rd, 2013 at 2:01pm
Print Post  
Hi,

I need to restrict the nodes moving out of the diagram canvas while dragging, re-sizing, child adding etc. In-fact i don't want any shapes to go out of canvas at any user actions.

Thanks
Kiran B
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Restrict the nodes from moving outside the diagram canvas
Reply #1 - Apr 24th, 2013 at 6:34am
Print Post  
Hi,

You could prevent it from nodeModifying and nodeCreating events like this:

Code
Select All
function onNodeModifying(sender, args)
{
	if (!sender.getBounds().contains(args.getNode().getBounds()))
		args.setCancel(true);
} 



Alternatively, align the node to nearest diagram border if you detect it's not entirely inside diagram.Bounds from nodeCreated/nodeModified handlers.

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