Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(widgets): handle registration and state delivery #7

Merged
merged 11 commits into from
Aug 23, 2024
4 changes: 2 additions & 2 deletions examples/pyvista/drap2dsurf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def _ui(self):
):
if WASM:
self.html_view = vtklocal.LocalView(self.render_window)
# for w in self.widgets:
# self.html_view.register_widget(w)
for w in self.widgets:
self.html_view.register_widget(w)
else:
self.html_view = vtk_widgets.VtkRemoteView(
self.render_window, interactive_ratio=1
Expand Down
5 changes: 1 addition & 4 deletions examples/vtk/glyph.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,7 @@ def on_resolution_change(self, resolution, **kwargs):
@change("camera")
def on_camera_change(self, camera, **kwargs):
if camera is not None:
self.view_local.object_manager.RegisterState(json.dumps(camera))
# FIXME - need to only apply camera state
self.view_local.object_manager.UpdateObjectsFromStates()
# FIXME - bug end
self.view_local.object_manager.UpdateObjectFromState(json.dumps(camera))
jspanchu marked this conversation as resolved.
Show resolved Hide resolved
self.view_remote.update()

def reset_camera(self):
Expand Down
6 changes: 1 addition & 5 deletions vue-components/src/components/VtkLocal.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,7 @@ export default {
observerTags.push([
cid,
sceneManager.addObserver(cid, "ModifiedEvent", () => {
// slow => python ./examples/pyvista/drap2dsurf.py --server
// state update => python ./examples/vtk/glyph.py --server
// FIXME
// slow but needed to make camera event working
// sceneManager.updateStatesFromObjects();
sceneManager.updateStateFromObject(cid);
jspanchu marked this conversation as resolved.
Show resolved Hide resolved
const cameraState = sceneManager.getState(cid);
emit("camera", cameraState);
}),
Expand Down
Loading