Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic dotted link (Read 2550 times)
liza
Full Member
***
Offline


I Love MindFusion!

Posts: 132
Joined: Apr 25th, 2019
dotted link
May 1st, 2019 at 6:56am
Print Post  
Can I get dotted links instead of straight line for links?
  
Back to top
AIM  
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: dotted link
Reply #1 - May 1st, 2019 at 7:02am
Print Post  
Call links' setStrokeDashStyle method.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
liza
Full Member
***
Offline


I Love MindFusion!

Posts: 132
Joined: Apr 25th, 2019
Re: dotted link
Reply #2 - May 1st, 2019 at 7:18am
Print Post  
Thanks, but please can you tell me how can I use it.
  
Back to top
AIM  
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: dotted link
Reply #3 - May 1st, 2019 at 7:45am
Print Post  
Code
Select All
function onLinkCreated(diagram, e)
{
    e.getLink().setStrokeDashStyle(MindFusion.Drawing.DashStyle.Dot);
} 

  
Back to top
 
IP Logged
 
liza
Full Member
***
Offline


I Love MindFusion!

Posts: 132
Joined: Apr 25th, 2019
Re: dotted link
Reply #4 - May 1st, 2019 at 7:55am
Print Post  
Thanks Slavcho, but this appears to be very minute.  I want  big dashes with sufficient space between two dashes. Can I set dash width and space between two dashes?
  
Back to top
AIM  
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: dotted link
Reply #5 - May 1st, 2019 at 9:01am
Print Post  
Try the Dash style instead of Dot, or otherwise replace the DashStyle.apply function with your own version. The standard one looks like this -

Code
Select All
MindFusion.Drawing.DashStyle.apply = function (context, dashStyle)
{
	if (!context.setLineDash)
		return;

	var scale = 2 / context._mf_scale;
	if (dashStyle == 1)
	{
		context.setLineDash([4 * scale, scale]);
	}
	else if (dashStyle == 2)
	{
		context.setLineDash([scale, scale]);
	}
	else if (dashStyle == 3)
	{
		context.setLineDash([4 * scale, scale, scale, scale]);
	}
	else if (dashStyle == 4)
	{
		context.setLineDash([4 * scale, scale, scale, scale, scale, scale]);
	}
	else
	{
		context.setLineDash([]);
	}
}; 



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