Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Container anchors: Vertical mode bug? (Read 505 times)
CompaniaHill
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Jul 14th, 2023
Container anchors: Vertical mode bug?
Jul 14th, 2023 at 4:10pm
Print Post  
We have created a tool class that adds connection anchors to containers, with coordinates specified in AnchorPattern.Points using a mix of UnitType.Fixed and UnitType.Percentage. For example, in Horizontal mode, an output anchor could have its Y coordinate 12 Fixed units down from the top of the container, but its X coordinate at 100 Percentage units, to keep it always at the right side of the container even after it is resized. (We then use custom Draw code to render the anchor's appearance slightly outside the container's Bounds, but that is not important for this question.)

We have found that in Vertical mode, with an output anchor X coordinate at 15 Fixed units and a Y coordinate at 100 Percentage units, the anchor will render at the desired position but the mouse will not respect this position. Specifically, the hovering mouse cursor will change from arrow to hand, but dragging will initiate a selection box and not a new connection line. The "hot spot" for initiating a new connection line seems to be far below the actual position of the anchor.

We have tried many experiments: changing the exact coordinates set by AnchorPattern.Points, the values for our class's Bounds, or the behavior of our class's HitTest() and HitTestHandle() callback methods. No matter what we have tried, MindFusion seems to use its own internal logic to determine its cursor change and "hot spot" positions.

Is this a bug in the MindFusion code, because MindFusion is not expecting an anchor to be attached to a container? Or is there some change we can make to our application to get the correct mouse behavior?

Thank you.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3153
Joined: Oct 19th, 2005
Re: Container anchors: Vertical mode bug?
Reply #1 - Jul 17th, 2023 at 11:40am
Print Post  
I'm not seeing problems with this code -

Code
Select All
var point = new AnchorPoint(15, 100, false, true);
point.XUnit = UnitType.Fixed;
point.YUnit = UnitType.Percentage;

var pattern = new AnchorPattern(
	new AnchorPoint[] { point } );

var container = diagram.Factory
	.CreateContainerNode(10, 10, 40, 60);
container.AnchorPattern = pattern; 



https://mindfusion.eu/_samples/CtrAnchorPoints.zip

Quote:
the anchor will render at the desired position but the mouse will not respect this position. Specifically, the hovering mouse cursor will change from arrow to hand, but dragging will initiate a selection box and not a new connection line


The diagram allows drawing links from any point of the node, and only aligns to the anchor point once you start dragging. If your app changes cursors only in vicinity of anchor points, it might be overriding some hit testing code of ContainerNode or a behavior class. Please check if it correctly handles the UnitType.Percentage value. If you believe problem is on our side, please modify the test project above to reproduce and attach it here.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint