Closed danielabar closed 8 years ago
Yep. Consider circles to begin with though (or indeed), because cognition research tell us that people are attracted to round shapes, whereas spiky shapes signify danger or discomfort (there's little in nature that is spiky that is not harmful).
I'd split this to a first item/aim of "merely" rendering everything as a circle, feeding from the d3 force layout computation engine. Let me know if you'd like me to carve out where that "engine" part sits in any particular branch. The sooner we do this overall item, the cleaner we go forward....
And I said "merely" above, because it's not that naive putting it together for the first time, plus it's a first dive into raw SVG that requires wearing the SVG hat. But it's easy if you "view source" on the nodes rendered by d3 - that shows you what the SVG element should be like when in doubt :)
Last but not least - to avoid duplicate work - need a research task to consider whether GreenSock makes sense for the drawing or how to work GreenSock compatible. Overall all fun tasks requiring some investigation and a lot of pixel patience :)
re: gsap - my understanding is its for animation, but doesn't help with drawing or svg, so that would be a separate issue.
Fix the custom node element with a nested svg tag, as explained here
Also follow steps in force layout from d3 docs to compute static layout
Some of these might move to be separate issues
detached()
lifecycle callback but it does not work because element has already been removed from DOM at that point. Also tried to use pubsub from graph to node, but maybe timing issue, wasn't working either
Continue to use the D3 force layout to assign node positions (i.e. x and y values), but replace the rendering with custom SVG elements.
It doesn't have to be simple circles and lines, could be any custom design to represent source nodes. For example, different types like Class, Value etc. could be drawn differently. Although to start, might be simpler to just do circles and lines at first.
This will probably end up splitting into multiple issues as more complexity is discovered. Have to support drag and drop, keeping the edges connected as nodes move around, animations/transitions etc.
Consider an approach where each Node and Edge is implemented as an Aurelia custom element. Each node can accept properties via data binding such as its display text, position, etc. Then the node viewModel can expose display properties that are a function of the inputs (for example, each type can be a different color, size of node can be function of lines of text etc.).
Then the parent component or view can loop over the nodes to place them in the DOM.