Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic about selfloop (Read 732 times)
Nobu
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 24
Joined: Nov 27th, 2023
about selfloop
Mar 7th, 2024 at 5:16am
Print Post  
Is it not possible to specify the start and end points of the self-loop?

Currently, when a self-loop is created, it is automatically created at the top of the node.

Also, the LinkShape is changed from Cascading to Bezier.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3223
Joined: Oct 19th, 2005
Re: about selfloop
Reply #1 - Mar 7th, 2024 at 6:31am
Print Post  
You can specify them from SetSelfLoopShape event handler -

Code
Select All
void OnSetSelfLoopShape(object sender, LinkShapeEventArgs e)
{
	e.Handled = true;

	var link = e.Link;
	var r = link.Origin.Bounds;
	link.Shape = LinkShape.Cascading;

	var points = link.ControlPoints;
	points.Clear();
	points.Add(new PointF(r.X + 5, r.Y));
	points.Add(new PointF(r.X + 5, r.Y - 5));
	points.Add(new PointF(r.X - 5, r.Y - 5));
	points.Add(new PointF(r.X - 5, r.Y + 5));
	points.Add(new PointF(r.X, r.Y + 5));
	link.UpdateFromPoints();
} 



Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Nobu
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 24
Joined: Nov 27th, 2023
Re: about selfloop
Reply #2 - Mar 7th, 2024 at 8:24am
Print Post  
Thank you for your response.

When OnSetSelfLoopShape is reached, the ControlPoints of the Link is set to the Bezier value.

Is it possible to get the ControlPoints when the mouse is released?
  
Back to top
 
IP Logged
 
Nobu
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 24
Joined: Nov 27th, 2023
Re: about selfloop
Reply #3 - Mar 7th, 2024 at 8:37am
Print Post  
Sorry.

e.Handled = true

The above was missing.

I was able to achieve what I wanted.

Regards,
Nobu
  
Back to top
 
IP Logged
 
Nobu
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 24
Joined: Nov 27th, 2023
Re: about selfloop
Reply #4 - Mar 8th, 2024 at 9:47am
Print Post  
In a self-transition, a link will pass through a node if it is implemented with the following properties.
Is it possible to make it go around the outside of the target node?
--Proterty
RouteLinks: True
LinkShape: Cascading
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3223
Joined: Oct 19th, 2005
Re: about selfloop
Reply #5 - Mar 8th, 2024 at 11:35am
Print Post  
The sample code above places points around the node, have you left only the Handled assignment from it? AutoRoute does not apply to self-loops, so you'd just see the link as drawn by user if you don't assign to ControlPoints from that handler. If you want to specify only end points without other coordinates, you can still call the Route method:

Code
Select All
void OnSetSelfLoopShape(object sender, LinkShapeEventArgs e)
{
	e.Handled = true;

	var link = e.Link;
	var p = link.StartPoint = e.Link.Origin.Bounds.Location;
	link.StartPoint = new PointF(p.X + 10, p.Y);
	link.EndPoint = new PointF(p.X + 20, p.Y);
	link.Route();
} 



Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Nobu
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 24
Joined: Nov 27th, 2023
Re: about selfloop
Reply #6 - Mar 8th, 2024 at 12:25pm
Print Post  
I was able to implement it based on your answer.

Regard,
Nodu
« Last Edit: Mar 8th, 2024 at 2:41pm by Nobu »  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint