clarkmcc / ngraph

A blender-style node editor for React, built on xyflow
https://ngraph.clarkmccauley.com
MIT License
50 stars 3 forks source link

disabled:true #30

Open sroussey opened 9 months ago

sroussey commented 9 months ago

Sometimes you just want to show the data!

clarkmcc commented 9 months ago

Makes sense. How do you feel about the how components look visually when they're disabled. For example inputs are greyed out, should nodes be greyed out? What about custom inputs that maybe can't be greyed out.

Alternatively we could maybe just disable all state updates and the graph would look the same but nothing would change.

sroussey commented 9 months ago

I think we pass the disabled property down and don't make is a optional param. The default would be however the input UI elements handle disabled, which is usually to grew out, etc. We can also add a disabled class on the top div and people can choose their own adventure on how to have the whole node deal with it.

sroussey commented 9 months ago

I think the bigger issue is do we do things that disable connecting, etc.

I don't think a full state update block is a good idea since it may be disabled but still change. For example, if I have a node task and it is running, then the inputs / outputs should be disabled from changing (including connecting handles), but as the task runs it might change the node data to represent what is going on.

clarkmcc commented 9 months ago

I'll do some research on disabling connections and then take a stab at this.

sroussey commented 9 months ago

In HTML, btw, there are two ways to prevent editing: readonly and disabled. People use readonly less often (no real ui feedback unless you try to edit), and more often use disabled. In theory, disabled is a superset of readonly.

clarkmcc commented 9 months ago

Okay, it looks like we can use nodesConnectable property to disable editing connections.