hi,
I've created nodes with custom html+css.
Now I would like to style my ports. Is there a way to do this with html+css?
If not, I can make my port transparent and place an div below the port, which works fine.
But then I have the problem, that its mouseover-event doesn't get fired because the port above is covering the div.
How can I bubble the event to the custom div below the port so that I can do something onmouseover (brighen it up).
I also checked the css-classes but I guess the hovering over a port is not firing a css-class:hover, right?
Best regards
|
#node1_port1:hover{
fill:red;
stroke-width: 20px;
stroke: red;
} |
thanks for your answer!
so the html-id of the port is always {nodeid}_{portid}?
In this case I would have to know the id at design-time, right?
is there a way to access the style at runtime?
Best Regards
Tobias
|
function clickHandler() {
var node = diagramInstance.selectedItems.nodes[0];
for (var i = 0; i < node.ports.length; i++) {
var port = document.getElementById(node.id + '_' + node.ports[i].id);
port.setAttribute('style', 'fill:red');
}
} |
hi Aravind,
thank you for this!
I would have to change this style when I create the node.
I guess there is no way to edit this style when creating a port at runtime, right?
But there is the collectionchange-event where I could grap the newly added node (only at this point.
can you provide a sample how to identify what kind of element was added to the diagram?
this is how I identified nodes and connections today:
but this wouldn't identify p
|
collectionChange={(args) => {
if (args.state === 'Changed' && args.type === 'Addition') {
if (args.element instanceof Node) {
alert('Node has been added');
} else {
alert('Connector has been added');
}
}
}} |