multiple render views share a widgetState

I want to share a widgetState across multiple render views, but I don’t know how to add or bind widgetState to widgets after factory generation. Is there anyone who can help me? I really hope to receive your reply

You typically have 1 widget manager per render window.
You will therefore have 1 widget (factory) instance and you add it to each widget manager with addWidget. They will all share the same widget state.

const lineWidget = vtkLineWidget.newInstance();
views.forEach((view) -> {
  const viewWidgetManager = widgetManagers[view];
  const viewLineWidget = viewWidgetManager.addWidget(lineWidget);
1 Like

Very happy to hear from you, thank you very much, it helped me a lot, thank you again, thank you!

Now there is a problem that I addWidget to multiple rendering windows, which can be added successfully, but it will be stuck and cannot be operated.