Surface Formula Editor Debug Procedure
Use this procedure when the surface formula editor looks stuck, shows errors, or fails after switching to another object.
Quick Triage (User Flow)
- Open
Surfacesmode and ensure dataset issurface. - Open
Surface editor. - Check the validation banner:
Valid expression: parser accepted current inputs.Needs attention: expression or required data is invalid/incomplete.- If you switched to a different surface object while the editor was open, reopen the editor for that object.
- Current behavior auto-closes the editor on object switch to avoid stale state.
Is Custom Formula Required?
For direct formula editing, the active object must be editable as custom.
Graphviewer:- Custom target is
graph_custom. - Opening the editor from a preset auto-converts to custom when possible.
Implicitviewer:- Custom target is
implicit_custom. - Opening the editor from a preset auto-converts to custom when possible.
Paramviewer:- Use
customparam surface for x(u,v), y(u,v), z(u,v) editing. - Rotational surfaces support:
Formulamode (r(v),z(v)), orPoints/Splinemode with profile points text.
Weierstrassviewer:- Requires valid
g(z)andphi(z).
Minimal Known-Good Inputs
Use these to separate parser issues from UI/state issues.
- Graph:
sin(x)*cos(y) - Implicit:
x^2 + y^2 + z^2 - 1 - Param:
x(u,v) = cos(u)*(1+0.3*cos(v))y(u,v) = sin(u)*(1+0.3*cos(v))z(u,v) = 0.3*sin(v)- Rotational formula:
r(v) = 0.4 + 0.2*cos(v)z(v) = 0.5*sin(v)
Failure Isolation Checklist
- Confirm the failure reproduces after entering one known-good input.
- Switch object, confirm editor closes, then reopen and re-test.
- If
Needs attentionpersists, copy the full detail text (includes parse column). - If parser is valid but render still fails, test with lower resolution in editor advanced settings.
- Reset to a default preset, reopen editor, and re-apply the custom expression.
Input Hang Debug Logs
Dedicated formula-editor input tracing is opt-in.
Typing stability mode:
- Graph/implicit editors use manual apply.
-
Type in textarea, then use
Apply(orCtrl+Enter) to update the rendered surface. -
Open DevTools Console.
- Run:
localStorage.setItem("math3d:formula-editor-debug", "1") - Reload app/view.
- Reproduce the hang while watching Console for
FormulaEditorDebugevents: graph.input.focus/implicit.input.focusgraph.input.keydown/implicit.input.keydowngraph.input.beforeinput/implicit.input.beforeinputgraph.input.change/implicit.input.changegraph.flush.commit/implicit.flush.commitgraph.flush.frame/implicit.flush.frame(dtMsis UI lag after commit)- Copy the last 30
FormulaEditorDebuglines when input freezes.
Disable tracing (optional):
- Run:
localStorage.setItem("math3d:formula-editor-debug", "0") - Reload app/view.
Report Template (for bug tickets)
Include all of:
- Viewer kind (
graph,implicit,param,weierstrass) - Selected object id before and after switch
- Exact expression(s) entered
- Validation detail text
- Whether issue reproduces with a known-good input
- Whether issue reproduces after editor close/reopen