Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic setCancel not bringing back the children back to original position (Read 4463 times)
Kiran B
Full Member
***
Offline


I Love MindFusion!

Posts: 102
Joined: Apr 19th, 2013
setCancel not bringing back the children back to original position
Apr 19th, 2013 at 11:24pm
Print Post  
Hi,

I am having a container node and the container is having some children inside. Based on some logic on the onNodeModifying event i am calling args.setCancel(true). The problem is the container is coming back to the original position, but the children are not coming back to the original position.

function onNodeModifyingScript(sender, args) {
                   args.setCancel(true)
               }
Thanks
Kiran B
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: setCancel not bringing back the children back to original position
Reply #1 - Apr 22nd, 2013 at 10:08am
Print Post  
Hi,

For the time being, override the following ContainerNode methods as work-around:

Code
Select All
var ContainerNode = MindFusion.Diagramming.ContainerNode;

ContainerNode.prototype.startDrag = function (ist)
{
	ContainerNode.callBaseMethod(this, "startDrag", [ist]);
	Array.forEach(this.children, function (child)
	{
		ist.originalStates.set(child, child.saveLocationState(ist));

	});
};

ContainerNode.prototype.cancelDrag = function (ist)
{
	ContainerNode.callBaseMethod(this, "cancelDrag", [ist]);
	Array.forEach(this.children, function (child)
	{
		child.restoreLocationState(ist);
	});
}; 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Kiran B
Full Member
***
Offline


I Love MindFusion!

Posts: 102
Joined: Apr 19th, 2013
Re: setCancel not bringing back the children back to original position
Reply #2 - Apr 22nd, 2013 at 10:55am
Print Post  
Thanks Stoyan. Now its works, but only bringing the immediate children back. How to bring back the nested children also?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: setCancel not bringing back the children back to original position
Reply #3 - Apr 22nd, 2013 at 2:23pm
Print Post  
Try this version of the methods instead:

Code
Select All
ContainerNode.prototype.startDrag = function (ist)
{
	ContainerNode.callBaseMethod(this, "startDrag", [ist]);
	Array.forEach(this.children, function (child)
	{
		child.startDrag(ist);
	});
};

ContainerNode.prototype.cancelDrag = function (ist)
{
	ContainerNode.callBaseMethod(this, "cancelDrag", [ist]);
	Array.forEach(this.children, function (child)
	{
		child.cancelDrag(ist);
	});
}; 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Kiran B
Full Member
***
Offline


I Love MindFusion!

Posts: 102
Joined: Apr 19th, 2013
Re: setCancel not bringing back the children back to original position
Reply #4 - Apr 23rd, 2013 at 5:03am
Print Post  
Hi Stoyan,

Now i am not able to move the container to anywhere in the diagram.

I am having a container node with some child nodes which is inside another container(Parent Container).

Now the Parent Container is not able to move or re-size inside the diagram.

Thanks
Kiran B
« Last Edit: Apr 23rd, 2013 at 6:04am by Kiran B »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: setCancel not bringing back the children back to original position
Reply #5 - Apr 23rd, 2013 at 6:35am
Print Post  
Hi Kiran,

The code above does not prevent you from moving containers. Perhaps your nodeModifying handler sets the Cancel flag for that container?

Stoyan
  
Back to top
 
IP Logged
 
Kiran B
Full Member
***
Offline


I Love MindFusion!

Posts: 102
Joined: Apr 19th, 2013
Re: setCancel not bringing back the children back to original position
Reply #6 - Apr 23rd, 2013 at 8:27am
Print Post  
Hi Stoyan,

Sorry man. The code is working fine. There was some issue with my code in setting the bool value for setCancel method.

Thanks
Kiran B
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint