Link target port points towards 0,0
See original GitHub issueI have an issue when trying to automatically link new nodes to the previous node. The link finds its source port (the Create node in image), but the target port is pointing towards 0,0 instead of the new node CreateDatabase. Yet they are linked - moving CreateDatabase also moves the link end vertex.
The node and link are inserted on an onClick event triggerring the following function.
addManipulator(event) {
let { engine } = this.props;
let model = engine.getDiagramModel();
var node = new ManipulatorNodeModel({
name: event.target.value
});
node.setPosition(500+Math.random()*100, 350+Math.random()*100);
model.addNode(node);
var previousNode = model.nodes[this.props.previousNodeId];
if(previousNode) {
var fromPort = previousNode.getOutPorts()[0]; // Assume 1 port only
var toPort = node.getInPorts()[0]; // Assume 1 port only
var link = fromPort.link(toPort);
model.addLink(link);
}
this.props.registerPreviousNode(node.id);
this.props.reDrawDiagram(Date.now());
}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Relative URL to a different port number in a hyperlink?
Here is a method to change the URL just after the page loads, ... if (port) { target.href = window.location.origin; target.port = port[1];...
Read more >Joints js connect to ports on a specified point alone
Hi,. How can i allow a link to be connected to a port on a specified point alone , in the below diagram...
Read more ><a>: The Anchor element - HTML: HyperText Markup Language
The HTML element (or anchor element), with its href attribute, creates a hyperlink to web pages, files, email addresses, locations in the ...
Read more >How to use Nmap to scan for open ports - TechTarget
To launch a default scan, the bare minimum you need is a target. ... system call to obtain the port state information, meaning...
Read more >Working with Ports (Outdated) - JointJS
A link might then point not to the element as a whole but to a certain port instead. JointJS has a built-in support...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Got this problem as well (v6). Solved it with doing reportPosition for all ports:
Fixing after drawing:
Or fixing before drawing:
@Letrab thank you! Your solution works perfectly!