Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Cancel node modifying with subordinate nodes (Read 3455 times)
danilom
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 16
Location: Italy
Joined: Feb 23rd, 2012
Cancel node modifying with subordinate nodes
Apr 10th, 2012 at 7:40am
Print Post  
Hi Stoyan,
We have nodes with attached subordinate nodes.
If we select the parent node and we move it (using the mouse) all the subordinate nodes follow the parent node automatically.
If in the NodeModifyig event we set e.cancel=true and we release the mouse the selected (parent) node comes back to its original position but the subordinate nodes position is not restored.
Is it possible to automatically reset subordinate nodes position too?

Best Regards,
Danilo
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Cancel node modifying with subordinate nodes
Reply #1 - Apr 10th, 2012 at 5:30pm
Print Post  
Hi Danilo,

Setting e.Cancel in my test app returns the attached nodes to their original locations. Is there anything else that you do from the NodeModifying handler?

Stoyan
  
Back to top
 
IP Logged
 
danilom
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 16
Location: Italy
Joined: Feb 23rd, 2012
Re: Cancel node modifying with subordinate nodes
Reply #2 - Apr 11th, 2012 at 8:10am
Print Post  
Hi Stoyan,
In effect setting only e.Cancel=true it works well.
In my NodeModifying event I call the Move method on the parent node because I want to keep aligned to the grid one of its point (not the standard top left point)
This Move seems causing the problem.
In attach you find a simplified example reproducing the issue.

Danilo
  

TubeDesigner_001.zip (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Cancel node modifying with subordinate nodes
Reply #3 - Apr 11th, 2012 at 11:24am
Print Post  
Hi Danilo,

Calling Move to change nodes positions from validation events isn't that good idea because it clears some internal flags used during interaction. Using the more lower-level SetBounds method seems to work though:

Code
Select All
private void TubeDesignerDiag_NodeModifying(object sender, NodeValidationEventArgs e)
{
	var dstPt = new Point(e.Node.Bounds.X + 1, e.Node.Bounds.Y - 1);
	var r = new Rect(dstPt, e.Node.Bounds.Size);
	e.Node.SetBounds(r, false, true);

	e.Cancel = true;
} 



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


I Love MindFusion!

Posts: 16
Location: Italy
Joined: Feb 23rd, 2012
Re: Cancel node modifying with subordinate nodes
Reply #4 - Apr 11th, 2012 at 2:44pm
Print Post  
OK Stoyan,
your solution is working perfectly.

Thank you,
Danilo
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint