From 48d07e8736b8920d4251321e1b5b5c35722f1615 Mon Sep 17 00:00:00 2001 From: RobTheFiveNine <49003204+RobTheFiveNine@users.noreply.github.com> Date: Thu, 1 Oct 2020 17:44:54 +0100 Subject: [PATCH] Add documentation on customising link tooltips --- guides/README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/guides/README.md b/guides/README.md index db26a2c27..cf86fae78 100644 --- a/guides/README.md +++ b/guides/README.md @@ -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: