Spaces:
Sleeping

MichaelRKessler commited on
Commit
f9e229a
·
1 Parent(s): a757b96

fixed layout to fit 3 across on laptop & fixed reset button in viewer

Browse files

Root cause — In Gradio 6.10, the Model3D Undo (reset) button is wired to a Svelte-local state has_change_history in Index-DN7eG78L.js:330 that only flips to true inside handle_change, which fires only when the user uploads through Model3D's own upload widget. Since your app supplies the model value programmatically from the gr.File component, that handler never runs, so the button stays permanently disabled. The has_change_history flag is not exposed as a Python prop, so it can't be set from app.py.

Fix — In app.py:

Added APP_HEAD containing a small <script> with a MutationObserver that strips the disabled attribute off any .model3D button[aria-label="Undo"] whenever Svelte sets it. The button's onclick handler is still wired up — disabling only blocks the click — so once enabled, clicks reach handle_undo → canvas3d.reset_camera_position() → viewer.resetCamera().
Added a small CSS rule in APP_CSS so the button no longer renders in its grayed-out state.
Moved css and head from the gr.Blocks(...) constructor to demo.launch(...), since Gradio 6.0 moved those parameters and the old call site was already emitting a deprecation warning.

1 file changed +52 -3
app.py+52-3