Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Link customization (Read 2848 times)
JaymeW
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 24
Joined: Oct 14th, 2021
Link customization
Oct 27th, 2021 at 11:43am
Print Post  
Hi, I'm studying the customization of links and I have a question: is it possible to define the links created dynamically by the user to be a straight line? This is because depending on the position of the nodes, the link makes several curves to get to the node. One example:

  

Sem_tG_tulo.png ( 5 KB | 108 Downloads )
Sem_tG_tulo.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Link customization
Reply #1 - Oct 27th, 2021 at 11:58am
Print Post  
Hi,

Set the Shape property of links to Polyline and disable AutoRoute.

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


I Love MindFusion!

Posts: 24
Joined: Oct 14th, 2021
Re: Link customization
Reply #2 - Oct 27th, 2021 at 12:57pm
Print Post  
Hi,

I tried to add the following lines:
Code (Javascript)
Select All
var theme = new Theme();

var linkStyle = new Style();
linkStyle.setStroke("#7F7F7F");
linkStyle.setStrokeThickness(1.0);
linkStyle.setTextColor("#585A5C");
linkStyle.setFontName("Verdana");
linkStyle.setFontSize(3);
linkStyle.setShape('polyline');
linkStyle.setDynamic(false);
theme.styles["std:DiagramLink"] = linkStyle;

diagram.setTheme(theme);
 



Nodes stopped being displayed.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Link customization
Reply #3 - Oct 27th, 2021 at 1:06pm
Print Post  
Try copying theme.styles["std:ShapeNode"] from Theme.Default.
  
Back to top
 
IP Logged
 
JaymeW
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 24
Joined: Oct 14th, 2021
Re: Link customization
Reply #4 - Oct 27th, 2021 at 2:44pm
Print Post  
It worked, thanks for the help.  Cheesy
  
Back to top
 
IP Logged
 
JaymeW
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 24
Joined: Oct 14th, 2021
Re: Link customization
Reply #5 - Oct 27th, 2021 at 2:49pm
Print Post  
One last question about customizing links. How could I adjust the text label to not be on top of the line like in the image?
  

Sem_tG_tulo_001.png ( 5 KB | 110 Downloads )
Sem_tG_tulo_001.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Link customization
Reply #6 - Oct 27th, 2021 at 3:00pm
Print Post  
Try different values from LinkTextStyle enum, which you can assign to TextStyle property. Alternatively call the addLabel method instead of setting Text, and either set LinkLabel's AutoArrange property, or specify your preferred offsets by calling one of the set*Position methods.

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


I Love MindFusion!

Posts: 24
Joined: Oct 14th, 2021
Re: Link customization
Reply #7 - Oct 18th, 2022 at 11:30am
Print Post  
Hi, I'm looking for a way to make the link color transparent. I need to show the user that the link they created is incorrect, so in addition to changing the color to red, I want the link to appear transparent. How can I do this?
Here an example:
Code (Javascript)
Select All
    var corLinkErrada = "#FF0000";
    var tamanhoLinkErrada = 2.0;
    link.setStroke(corLinkErrada);
    link.setStrokeThickness(tamanhoLinkErrada);
 

  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Link customization
Reply #8 - Oct 18th, 2022 at 12:43pm
Print Post  
Hi,

Try RRGGBBAA hex, or any other CSS notation for colors:

Code
Select All
link.stroke = "#FF000099";
link.stroke = "rgba(255,0,0,0.6)";
 



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


I Love MindFusion!

Posts: 24
Joined: Oct 14th, 2021
Re: Link customization
Reply #9 - Oct 18th, 2022 at 3:22pm
Print Post  
Yes, thank you  Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint