Merge pull request #175 from RobTheFiveNine/documentation/link-tooltips

Add documentation on customising link tooltips
This commit is contained in:
Javi Agenjo
2020-10-01 18:57:11 +02:00
committed by GitHub

View File

@@ -113,6 +113,25 @@ Slots have the next information:
To retrieve the data traveling through a link you can call ```node.getInputData``` or ```node.getOutputData```
### Customising Link Tooltips
When hovering over a link that connects two nodes together, a tooltip will be shown allowing the user to see the data that is being output from one node to the other.
Sometimes, you may have a node that outputs an object, rather than a primitive value that can be easily represented (like a string). In these instances, the tooltip will default to showing `[Object]`.
If you need a more descriptive tooltip, you can achieve this by adding a `toToolTip` function to your object which returns the text you wish to display in the tooltip.
For example, to ensure the link from output slot 0 shows `A useful description`, the output object would look like this:
```javascript
this.setOutputData(0, {
complexObject: {
yes: true,
},
toToolTip: () => 'A useful description',
});
```
### Define your Graph Node
When creating a class for a graph node here are some useful points: