Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic HandlesStyle behavior (Read 1553 times)
Cornel
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Dec 17th, 2008
HandlesStyle behavior
Aug 10th, 2009 at 2:00pm
Print Post  
Hi there,
I need to create the following behavior:
when the mouse is over a node, that node should be highlighted and it should be possible to start moving it directly (without selecting it first); in case a node was already selected then it should also be possible to resize it besides moving.

So, I would say this is a combination between MoveOnly and SquareHandles2 (but without the region near boundary for creating links).

How can I create this functionality?

Thanks in advance,
Cornel
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: HandlesStyle behavior
Reply #1 - Aug 11th, 2009 at 7:16am
Print Post  
Hi,

This version adds a DiagramView.AutoHandlesItem property that returns the highlighted node when ModificationStart == AutoHandles.:

https://mindfusion.eu/_beta/fcnet_autohandles.zip

Now you can implement what you need using a custom Behavior class or by setting HandlesStyle to Custom and handling HitTestHandles. E.g. with a custom behavior:

Code
Select All
public class MyBehavior : LinkShapesBehavior
{
	public MyBehavior(DiagramView view) : base(view)
	{
	}

	public override InteractionState StartDraw(PointF point)
	{
		int handle = -1;

		DiagramNode node = Diagram.GetNodeAt(point);
		if (node != null &&
			(node == DiagramView.AutoHandlesItem ||
			!node.HitTestHandle(point, ref handle)))
		{
			Diagram.Selection.Change(node);
			return new InteractionState(node, 8, Action.Modify);
		}

		return base.StartDraw(point);
	}
}

// in form_load
diagramView.CustomBehavior = new MyBehavior(diagramView);
 



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