-
Notifications
You must be signed in to change notification settings - Fork 423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change node color on mouse event #77
Comments
Hello @quentinflahaut. Are you using webgl or svg renderer? If all you need is changing a node color, I'd recommend to update its ui properties, instead of updating a model. If you can share a jsfiddle link, I'll be able to help |
@anvaka Thank you for your reply. |
Hi @quentinflahaut, sorry I was completely busy last couple months. Hope it's not to late to give an answer. Since you are using svg, you can change fill as you would normally do: img.attr('fill', 'deepskyblue'); I updated the fiddle: http://jsfiddle.net/anvaka/2LQmB/3/ |
Sorry, what about the case where using webGL? |
@ArnauC you can use |
But I don't see how can I change the color of a node dynamically. Something like: var events = Viva.Graph.webglInputEvents(graphics, graph); How can I define a method changeColor that accesses the node and change its color? |
@ArnauC you can use approach similar to the multiselect example: var nodeUI = graphics.getNodeUI(nodeId);
nodeUI.color = 0xFFA500FF; Where renderer.rerender() |
Changing the color node can be done via
gaph.addNode(nodename, nodedata)
however, when i call this operation during an event, the graph dispay weird position on my node.
I believe that it happen because the graph delete the node and then recreate it losing the last position. And then position are setted again once the event is finish.
Could you give me an idea how to manage this problem ?
The text was updated successfully, but these errors were encountered: