Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Behavior (Read 3430 times)
castefani
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 44
Joined: Feb 26th, 2009
Behavior
Mar 23rd, 2009 at 7:59pm
Print Post  
I need that my diagram is different behavior patterns of the modes.
Behavior.Modify tried to define CustomBehavior and even then still can not implement what they want.
I need the following features:

- When you click on a node and drag it, move it
- When you click on a AnchorPattern, create a link
- When there are multiple nodes selected, the resize to a node, to resize all nodes in the selection
- Select nodes by clicking directly on the diagram, but without pressing the control key
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Behavior
Reply #1 - Mar 24th, 2009 at 8:56am
Print Post  
You could create a custom BehaviorBase-derived class whose StartDraw method returns one of the following depending on where the mouse cursor is located:

// to move a node;
return new InteractionState(node, Action.Modify, 8);

// to create a link
link = CreateLink(originNode, point);
return new InteractionState(link, Action.Create, link.ControlPoints.Count - 1);

// to draw selection rectangle
return new InteractionState(Diagram.Selection, Action.Create, -1, point);

We'll try to implement multiple resize in the next few days.
  
Back to top
 
IP Logged
 
castefani
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 44
Joined: Feb 26th, 2009
Re: Behavior
Reply #2 - Mar 25th, 2009 at 8:40pm
Print Post  
how do I know if the cursor is on the drawing area on a link or on one node?
  
Back to top
 
IP Logged
 
castefani
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 44
Joined: Feb 26th, 2009
Re: Behavior
Reply #3 - Mar 25th, 2009 at 8:42pm
Print Post  
how do I know if the cursor is on the drawing area on a link or on one node?

And on a AnchorPattern?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Behavior
Reply #4 - Mar 26th, 2009 at 5:39am
Print Post  
Use the GetLinkAt and GetNodeAt methods. For nodes, loop over their anchor points and multiply the node width and height by the point's X and Y values divided by 100. Now if the mouse position is not further than a few pixels, you can count this a hit on the anchor point.

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