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
Add more events to be handle on d3-network components #12
Conversation
…or simulation start, tick and stop.
First, thanks for contribute to this project.
The addition of ids is unnecesary, you can add ids on _svgAttrs object.
.....
https://jsfiddle.net/emii/wq6stonL/ About events: I didn't have time to analyze this. |
Hi. I agree with you for the id. So I will remove it however I will let the newly handle events. In addition I am looking for a way to add text on links. I will let you know if I succeed :) |
Text on links image |
src/components/svgRenderer.vue
Outdated
@@ -84,9 +83,18 @@ | |||
:x='node.x + (getNodeSize(node) / 2) + (fontSize / 2)' | |||
:y='node.y + labelOffset.y' | |||
:font-size="fontSize" | |||
:class='(node._labelClass) ? node._labelClass : ""' | |||
:class='(node._labelClass) ? node._labelClass : "node-label"' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?.... text.node-label.....
…ys represented as Path (in order to use textPath elements for labels)
I don't understand why you removed the sim events. I understand it is now possible for the user to use simCb to add his own event using the callback but it is somehow counter intuitive. Your component should be easy to use and give the developpers features without having him looking at every doc of the internal components you use (in my view). If tomorrow another lib is used internally to generate the graph, then the developper will have to rewrite his code to support sim-start / sim-end and sim-tick events. Eventually I manage to have labels on the links as you did. I did not look at how you implemented it. I guessed you used the same method as I (using path instead of line and textPath). However I ve seen another use case that allows developper to have up to 3 labels onto a link. I think name (for node as well as for link) should be rename into label. In my solution, link.name can be either a string or an array of length 1, 2 or 3
Let me know what do you think about all of this. Plus it could be great to close the request if you implement everything that is in this request. |
I perform a merge and re-compile the files this should be ok. Here is the list of new features:
|
I have one issue with the canvasRendered where labels are not rendering. I did not investigate on this point since I never worked on the canvasRenderer. |
I think that the simCb option open more possibilities for set the simulation. |
The link labels does not work on canvas yet. |
@vibou In the future, please, separate your pull request by features. |
Great. Yeah next feature I ll do another branch. Thanks for your lib which is great ! :P |
New events handled:
sim-start
sim-tick
sim-end
mouse-enter-node
mouse-leave-node
mouse-enter-link
mouse-leave-link