chrisjpatty / flume

Extract logic from your apps with a user-friendly node editor powered by React.
https://flume.dev
MIT License
1.46k stars 147 forks source link

Resizable Nodes #31

Open numso opened 4 years ago

numso commented 4 years ago

It would be awesome to have the ability to resize nodes at runtime (similar to how you can resize comments).

PhilGarb commented 4 years ago

Maybe this should be discussed as part of any upcoming theming approach #18? I think the NodeEditor, Nodes, Lines and Ports should be as configurable as possible. This of course includes resizing across the board.

numso commented 4 years ago

I'm not sure this fits under theming. I'll try to better explain what I was thinking but please let me know if I'm missing something obvious!

As I'm using the editor I've found that I want my nodes (even of the same NodeType) to be sized differently based on the entered content and, therefore, want the ability to resize those nodes at edit time. I'd want this ability regardless of how the editor was themed or appeared. Take the following example:

image

I am able to resize my comments depending on the size and type of text entered. I am unable to do the same for nodes.

Currently you can resize a textarea vertically and the node grows accordingly. One solution might be to allow the textarea to also be resized horizontally and grow the node that way as well. However, the textarea's size isn't persisted and wouldn't survive a refresh. I'm not sure how easy it would be to fix that.

Another option could be to add a drag-handle to the bottom right corner of nodes like the ones that exist for comments. I imagine this would be fairly trivial as this resizing code already exists and would just have to be adapted to nodes.

Thoughts?

chrisjpatty commented 4 years ago

@numso I think a drag handle on each node to allow it to be resized at least horizontally is the right approach. That puts it in line with the comments doesn't depend on the presence of a textarea. There's some considerations for handling resizing with max and min values, but I think that's probably the right approach.