Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic HitTestHandle can not be triggered in a polygon node! (Read 1542 times)
chowy
Junior Member
**
Offline


I Love MindFusion!

Posts: 72
Joined: May 8th, 2017
HitTestHandle can not be triggered in a polygon node!
Jun 26th, 2017 at 9:37am
Print Post  
I drew a polygon,When the mouse moves to the green line or above the point, can not trigger AdjustmentHandle HitTestHandle (Point point); only when the mouse moves to the black line above, can trigger this method.What method can I use to trigger it?In Behavior I wrote this way:
Code
Select All
            NodeItemBase nodeItemBase =
                        Diagram.GetNodeAt(mousePoint, NodeItemBase.CNEARNESSTHRESHOLD) as NodeItemBase;
            if (nodeItemBase == null || nodeItemBase is MousePointNode)
                return new Tuple<NodeItemBase, EHandleId>(null, handleId);
            NodeAdjustmentHandle adjustmentHandle = nodeItemBase.HitTestHandle(mousePoint) as NodeAdjustmentHandle;
 

  

MindFusionPolygon.png ( 15 KB | 93 Downloads )
MindFusionPolygon.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: HitTestHandle can not be triggered in a polygon node!
Reply #1 - Jun 26th, 2017 at 11:40am
Print Post  
I'm guessing GetNodeAt returns null when point is not inside the polygon and your code never gets to calling HitTestHandle. Apart from checking GetNodeAt result, standard behavior classes also call HitTestHandle on diagram.ActiveItem, so you could do that too from your custom behavior.

If only reason for derived behavior class is to let you draw nodes of custom types, note that you could implement that by setting diagram.Behavior = Custom and diagram.CustomNodeType = typeof(your node class) instead. If you have other reasons for creating custom behavior class, you could call base.StartDraw at some point to let the base class do hit-testing of existing items.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
chowy
Junior Member
**
Offline


I Love MindFusion!

Posts: 72
Joined: May 8th, 2017
Re: HitTestHandle can not be triggered in a polygon node!
Reply #2 - Jun 27th, 2017 at 12:58am
Print Post  
Slavcho wrote on Jun 26th, 2017 at 11:40am:
I'm guessing GetNodeAt returns null when point is not inside the polygon and your code never gets to calling HitTestHandle. Apart from checking GetNodeAt result, standard behavior classes also call HitTestHandle on diagram.ActiveItem, so you could do that too from your custom behavior.

If only reason for derived behavior class is to let you draw nodes of custom types, note that you could implement that by setting diagram.Behavior = Custom and diagram.CustomNodeType = typeof(your node class) instead. If you have other reasons for creating custom behavior class, you could call base.StartDraw at some point to let the base class do hit-testing of existing items.

Regards,
Slavcho
Mindfusion

Thanks!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint