Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Allow drag only horizontally (Read 5415 times)
PetrOs
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 36
Joined: May 26th, 2011
Allow drag only horizontally
Aug 1st, 2012 at 2:16pm
Print Post  
Hi,

I have a diagram which has several nodes. For some of them, I wanted to restrict the movement only to horizontal. I tried to modify the event args in the NodeModifying handler by using nodeValidationEventArgs.MousePosition.Offset method, but to no effect.
Any idea how to make this? Maybe there is yet another hidden MindFusion feature for this Wink

P.S. HandlesStyle is set to InvisibleMove, and the diagram to Behavior="Modify" ModificationStart="AutoHandles" if it makes any difference.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Allow drag only horizontally
Reply #1 - Aug 1st, 2012 at 2:57pm
Print Post  
Hi,

Set node.Constraints.MoveDirection = Horizontal. You might also want to disable top and bottom resize flags in the node.EnabledHandles bitmask, to prevent users from "moving" the node by resizing it at both sides.

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


I love YaBB 1G - SP1!

Posts: 36
Joined: May 26th, 2011
Re: Allow drag only horizontally
Reply #2 - Aug 2nd, 2012 at 9:19am
Print Post  
Thanks! And how can I forbid the movement at all for a specific node type (to allow only the resize)?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Allow drag only horizontally
Reply #3 - Aug 2nd, 2012 at 11:41am
Print Post  
Set node.EnabledHandles = ResizeHandles.

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


I love YaBB 1G - SP1!

Posts: 36
Joined: May 26th, 2011
Re: Allow drag only horizontally
Reply #4 - Aug 2nd, 2012 at 11:56am
Print Post  
It works great, thank you!
  
Back to top
 
IP Logged
 
PetrOs
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 36
Joined: May 26th, 2011
Re: Allow drag only horizontally
Reply #5 - Aug 2nd, 2012 at 3:13pm
Print Post  
One more question - how to restrict horizontal movement to one side (so the user can move the node only to the right from , say, x coordinate 40)?

catching NodeModifying and then canceling just causes the entire move being aborted, what is not good.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Allow drag only horizontally
Reply #6 - Aug 3rd, 2012 at 11:23am
Print Post  
If you mean the node should visually stop at x = 40 while being dragged, at this time that can be done by attaching your nodes to some locked transparent node that defines the allowed area, and setting their KeepInsideParent constraint. If you are using custom nodes, you could also enforce this in a UpdateModify override. Otherwise, you could move the node to x=40 from the NodeModified handler if you detect it was moved to the left of 40.

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


I love YaBB 1G - SP1!

Posts: 36
Joined: May 26th, 2011
Re: Allow drag only horizontally
Reply #7 - Sep 7th, 2012 at 12:28pm
Print Post  
thanks!

One more question - when the user drags the node with the mouse, is there an automatic way to make the diagram grow, and the surrounding scrollviewer to scroll to show the latest node position? I am using an override of UpdateModify
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Allow drag only horizontally
Reply #8 - Sep 7th, 2012 at 1:33pm
Print Post  
Try enabling the diagram's AutoResize and AutoScroll properties.

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