Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic HandlesStyle DashFrame and the move hit test (Read 1684 times)
j poz
Junior Member
**
Offline


I Love MindFusion!

Posts: 78
Joined: Nov 21st, 2012
HandlesStyle DashFrame and the move hit test
May 2nd, 2013 at 4:35pm
Print Post  
If I set a ShapeNode to have the DashFrame handles style, there is an area near the inside border but before the center of the node that if I click, it does not allow me to move the tool, instead attempting to select tools.

On the other hand, if you set the handles style to EasyMove, it allows you to select anywhere in the tool (except the resize handles) to move the tool.

How can I make the DashFrame act like the EasyMove when it comes to the moving the tool hit test?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: HandlesStyle DashFrame and the move hit test
Reply #1 - May 2nd, 2013 at 7:56pm
Print Post  
That area is reserved for drawing links, and the nodes' hit-testing code returns negative result indicating that the behavior class should do its default operation, which might be selection in some modes. You could set HandlesStyle to Custom instead, and implement events as follows:

Code
Select All
void OnDrawAdjustmentHandles(object sender, MindFusion.Diagramming.DrawItemEventArgs e)
{
	var node = (DiagramNode)e.Item;
	var style = node == diagram.ActiveItem ?
		diagram.ActiveItemHandlesStyle :
		diagram.SelectedItemHandlesStyle;

	InternalUtils.DrawSelHandles(
		e.Graphics,
		style,
		diagram.DisabledHandlesStyle,
		node.Bounds,
		node.RotationAngle,
		node.EnabledHandles,
		true,
		HandlesStyle.DashFrame,
		diagram.AdjustmentHandlesSize);
}

void OnHitTestAdjustmentHandles(object sender, HitTestEventArgs e)
{
	var node = (DiagramNode)e.Item;
	node.HandlesStyle = HandlesStyle.DashFrame;

	int handle = -1;
	node.HitTestHandle(e.MousePosition, ref handle);
	if (handle == -1 && node.ContainsPoint(e.MousePosition))
		handle = 8;
	e.HitResult = handle;
	node.HandlesStyle = HandlesStyle.Custom;
} 



Alternatively, use a custom behavior class that starts a move operation if hit-testing code returns -1 but mouse pointer is inside the node.

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