cytoscape/cytoscape.js-elk

Missing port functionality

azriel46d opened this issue · 6 comments

Is this functional with ports ? as I have tried setting the edges with a targets to a port and it returns an error

Hi,
I'm pretty new to cytoscape and elkjs, but AFACT ports aren't a supported thing in cytoscape (I could be wrong). Port support would help me with some of my work too.

If you think I'm wrong then please feel free to submit a PR and I'll turn it around pretty quick. This repo is a fork from the klayjs adapter, and is reasonably straightforward to follow.

layout.js is the place to look.

Thanks,
John

Thanks, as far as I know cytoscape does not support ports. What I think needs to be done is that the ports needs to be done is the following (I think)

  1. Extract all the ports from the nodes
  2. Add them as elements to cytoscape with renderedPosition: { x: 200, y: 200 }
  3. pass them through Elkjs (so the proper coords are retrieved (which I believe would be relative to the node) and update the positions of the node manually.
    The other option I have to look at is to use is compoundNodes however, like you I am quite new to cytoscape

That sounds like a good way forward. Happy for PRs etc.

A "port" is just an edge endpoint. Set scratch values under scratch.elk for the edge endpoint properties: http://js.cytoscape.org/#style/edge-endpoints

A consumer of the layout can set mappers to those scratch values -- so that they can be used optionally.

Hi,

Can you share a sample json with ports working? I am pretty new to elk js and trying to figure out how multiple ports can be used with the nodes.

Thanks
Sudar

stale commented

This issue has been automatically marked as stale, because it has not had activity within the past 14 days. It will be closed if no further activity occurs within the next 7 days. If a feature request is important to you, please consider making a pull request. Thank you for your contributions.