How can I set the styling of a cytoscape.js 'loop edge' so that it rotates counterclockwise about the bottom right corner of a long (150px wide) rectangular node?
I have been fiddling with the style settings and just can't figure it out. The best I can tell I should be able to tune these for styles to get what I want:
selector: '.loop',
style: {
'loop-direction': '?deg',
'loop-sweep': '?deg',
'target-endpoint': '90deg',
'source-endpoint': '105deg',
}
},
Which is something like this arrow, in red:
But I can't really get anything better than this snippet. I just can't get the curve to "flip" to the other side.
window.addEventListener('DOMContentLoaded', function() {
var cy = window.cy = cytoscape({
container: document.getElementById('cy'),
style: [{
selector: 'node',
style: {
'width': 150,
'shape': 'rectangle',
'background-opacity': 0.5,
}
},
{
selector: 'edge',
style: {
'line-color': 'black',
'target-arrow-color': 'black',
'target-arrow-shape': 'triangle',
'curve-style': 'bezier'
}
},
{
selector: '.loop',
style: {
'loop-direction': '90deg',
'loop-sweep': '-90deg',
'target-endpoint': '90deg',
'source-endpoint': '105deg',
}
},
],
elements: {
nodes: [{
data: {
id: 'n16'
}
}],
edges: [{
data: {
source: 'n16',
target: 'n16'
},
classes: 'loop'
}, ]
}
});
});
#cy {
width: 300px;
height: 200px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.15.1/cytoscape.min.js"></script>
<body>
<h1>cytoscape loop edge demo</h1>
<div id="cy"></div>
</body>

