Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic how to use ModifyBehavior class to limit movement of node? (Read 1647 times)
CanadaProgrammer
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
how to use ModifyBehavior class to limit movement of node?
Feb 22nd, 2014 at 10:10pm
Print Post  
my behavior class like below:
public class EMModifyBehavior : ModifyBehavior
{
     ...
}
This class also handle the NodeModified event of Diagram.
What I want to do is when user drag and move a node to right,
I control the node move to left.

So I override OnMouseMove method of ModifyBehavior. There are
ways to do it.
Way1:
protected override void OnMouseMove(Point mousePosition)
{
     base.OnMouseMove(mousePosition);
     
     my code something here;
}
everything can be done well. but it is flickering. User can
see node move to right first then move back to left. It is very
bad how to stop to flicker?

Way2:
protected override void OnMouseMove(Point mousePosition)
{
     my code something here;
}
No flickering at all, very good. but NodeModified event is not fired.
So I lost chance to do something.

How to implement this feature perfectly?
Thanks a lot
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: how to use ModifyBehavior class to limit movement of node?
Reply #1 - Feb 24th, 2014 at 8:31am
Print Post  
Quote:
Way1:


Try calling DiagramView.Refresh() after 'your code something there'.

Quote:
Way2:


You will have to call Diagram.Interaction.Start upon first mouse move, and if you are overriding MouseUp in same manner (without calling base), call Diagram.Interaction.Complete from it as well.

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


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
Re: how to use ModifyBehavior class to limit movement of node?
Reply #2 - Feb 25th, 2014 at 12:14am
Print Post  
Thanks。 it can work
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint