Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Link shape (Read 5672 times)
Silvia88
Full Member
***
Offline


I Love MindFusion!

Posts: 121
Joined: Aug 31st, 2015
Link shape
Sep 1st, 2015 at 8:28am
Print Post  
Hi,
is it possible to change the shape of links? I would like to have links without the arrow, simply made up of a line.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link shape
Reply #1 - Sep 1st, 2015 at 8:59am
Print Post  
Hi,

Call link.setHeadShape(ArrowHeads.None) for individual links, or diagram.setLinkHeadShape(...) to set default value for all new links.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Silvia88
Full Member
***
Offline


I Love MindFusion!

Posts: 121
Joined: Aug 31st, 2015
Re: Link shape
Reply #2 - Sep 1st, 2015 at 9:32am
Print Post  
Thank you very much, it works.
Is it possible to have also a double link, I mean a link made up of 2 lines?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link shape
Reply #3 - Sep 1st, 2015 at 9:57am
Print Post  
It's possible using custom-drawing:

Code
Select All
diagram.addDiagramListener(new DiagramAdapter()
{
	@Override
	public void linkCreated(LinkEvent e)
	{
		DiagramLink link = e.getLink();
		link.setCustomDraw(CustomDraw.Additional);
		link.setPen(new Pen(2, Color.red));
	}

	@Override
	public void drawLink(DrawLinkEvent e)
	{
		DiagramLink link = e.getLink();

		// draw using a thinner stroke in different color
		link.setCustomDraw(CustomDraw.None);
		link.setPen(new Pen(1, Color.white));

		link.draw(e.getGraphics(), diagram.getRenderOptions());

		// restore default stroke
		link.setCustomDraw(CustomDraw.Additional);
		link.setPen(new Pen(2, Color.red));
	}
} 



You might as well set CustomDraw = Full and draw using Android's low-level graphics API instead of calling link.draw for a second time.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Silvia88
Full Member
***
Offline


I Love MindFusion!

Posts: 121
Joined: Aug 31st, 2015
Re: Link shape
Reply #4 - Sep 1st, 2015 at 10:22am
Print Post  
Ok, thank you very much...
Is it possible to create a link between a node and already existing link?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link shape
Reply #5 - Sep 1st, 2015 at 10:53am
Print Post  
Links can only point to nodes. You can simulate link-to-link connection by attaching a small node to the existing link to serve as second link's target, using node.attachTo(link) method.
  
Back to top
 
IP Logged
 
Silvia88
Full Member
***
Offline


I Love MindFusion!

Posts: 121
Joined: Aug 31st, 2015
Re: Link shape
Reply #6 - Sep 1st, 2015 at 11:16am
Print Post  
Ok, thank you very much, i'll try  Smiley
  
Back to top
 
IP Logged
 
Silvia88
Full Member
***
Offline


I Love MindFusion!

Posts: 121
Joined: Aug 31st, 2015
Re: Link shape
Reply #7 - Sep 1st, 2015 at 3:32pm
Print Post  
Is it possbile to remove a link by code?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Link shape
Reply #8 - Sep 1st, 2015 at 4:09pm
Print Post  
Call diagram.getLinks().remove(link);

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Silvia88
Full Member
***
Offline


I Love MindFusion!

Posts: 121
Joined: Aug 31st, 2015
Re: Link shape
Reply #9 - Sep 1st, 2015 at 4:53pm
Print Post  
ok, thank you very much  Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint