miroiu / nodify

Highly performant and modular controls for node-based editors designed for data-binding and MVVM.
https://miroiu.github.io/nodify
MIT License
1.3k stars 208 forks source link

Text on Lines #63

Closed mercurial-moon closed 11 months ago

mercurial-moon commented 1 year ago

Hi , Is it possible to insert text on the connecting lines between nodes? I didn't see any preview of this feature in the demos that have been showcased. Would it be too difficult to implement this, if its not implemented yet, could you let me know what part of the code needs to be modified to implement this feature?

miroiu commented 1 year ago

Hi, this functionality is not implemented. However, it is possible to add a label to connection lines by adding a formatted text to the DefiningGeometry in BaseConnection. (see https://stackoverflow.com/questions/4180958/add-some-text-in-a-wpf-shape)

For an editable label you'd have to set the ConnectionTemplate in a NodifyEditor instance to a custom DataTemplate and figure out how to position the textbox on the line (probably inside a Canvas). Note that this solution may impact performance when rendering many lines.

Please let me know if you need more information.

miroiu commented 6 months ago

Hi, I created a PR to address this issue in case you still need the functionality.