You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Scope: move pointer, wheel and keyboard dispatch into createInputController(deps). The navigate reducer is untouched. Make the wheel zoom-anchor maths pure.
Acceptance: the same as #111. The recording's pointer, wheel and keyboard scenarios are unchanged.
Checked against origin/refactor/112-scene-labels at 0a96d69. The PR body starts with "⏸ Held until 2.0 ships (see #107)", then "Stacked on #122".
Files. All under packages/graph/src/, none exported:
input.ts: createInputController, zoomAbout, pastDragSlop. Not camera.ts: index.ts re-exports it through export *, so a helper there would change the public API.
input.test.ts
GraphCanvas.tsx
.changeset/graph-input-controller.md: patch, "Internal restructure; no API or behaviour change."
Shape.createInputController(deps) returns { dragging() }, because the frame loop reads it. Listeners register through deps.track.
hoveredIndex, selectedIndex and the tooltip state.
el, because the context-loss handler uses it.
Ordering
The controller is built once, where the pointer code is today.
It adds listeners in this order: window keydown, pointermove, pointerdown, window pointerup, click, pointerleave, wheel {passive:false}.
It uses two track entries, so the removal order doesn't change.
It is built before frame, and webglcontextlost is still registered last.
Unit-tested rather than recorded. The recordings are at 199.3 KB of 200 KB, so input.test.ts covers:
pointerleave
window Escape: suppression, preventDefault, and the early returns when the overlay is focused or there's no tooltip
suppression clearing on the next hover
the zoom clamp at both bounds, and the anchor fixed point
setPointerCapture throwing
cursor styles
the slop boundary at 3 and 3.5 px
dragging()
listener order and options
Acceptance
vitest run passes without -u, and git diff --exit-code packages/graph/src/__recordings__ is clean. That includes the listener lines in boot.mount and lifecycle.unmount.
browser/graph.spec.ts passes, with its baselines unchanged.
dist/index.d.ts and dist/index.d.cts are byte-identical to refactor/112-scene-labels, and the npm pack --dry-run file list is unchanged.
A prettier-formatted diff of dist/index.js shows relocation only.
Every new function is ≤ 60 code lines with cognitive complexity ≤ 12, and the graph lint warning count doesn't rise.
Built on refactor/112-scene-labels, with that branch as the PR's base. navigator.ts is untouched.
Activity
JadRizk commentedon Oct 11, 2026
Scope notes
Checked against
origin/refactor/112-scene-labelsat 0a96d69. The PR body starts with "⏸ Held until 2.0 ships (see #107)", then "Stacked on #122".Files. All under
packages/graph/src/, none exported:input.ts:createInputController,zoomAbout,pastDragSlop. Notcamera.ts:index.tsre-exports it throughexport *, so a helper there would change the public API.input.test.tsGraphCanvas.tsx.changeset/graph-input-controller.md: patch, "Internal restructure; no API or behaviour change."Shape.
createInputController(deps)returns{ dragging() }, because the frame loop reads it. Listeners register throughdeps.track.el,track,toWorld,pick,curve(),viewport,simulation(cursor,pin),rig(takeOver,panBy,live,target),hovered(),hover(i),showTooltip,dismissTooltip(),overlayFocused(),onPress(),click(i).zoomAboutkeeps today's expression order, and theviewport.curvewrite stays before the call.handlePointerMoveis split so it stays at complexity 12 or below.What stays in GraphCanvas, different from the issue's wording
dispatch,handleEscape, the nav overlay wiring and thenavigationstate. Their callers (api.current,applySelection,refilterKeepingCursor, the overlay) are wired before the input code.refreshand the frame loop also read that state. Revisit with Extract createFrameLoop #114/Follow-up: navigate, labels.place and physics.step (decision only) #115.hoveredIndex,selectedIndexand the tooltip state.el, because the context-loss handler uses it.Ordering
window keydown,pointermove,pointerdown,window pointerup,click,pointerleave,wheel {passive:false}.trackentries, so the removal order doesn't change.frame, andwebglcontextlostis still registered last.Unit-tested rather than recorded. The recordings are at 199.3 KB of 200 KB, so
input.test.tscovers:pointerleavepreventDefault, and the early returns when the overlay is focused or there's no tooltipsetPointerCapturethrowingdragging()Acceptance
vitest runpasses without-u, andgit diff --exit-code packages/graph/src/__recordings__is clean. That includes the listener lines inboot.mountandlifecycle.unmount.browser/graph.spec.tspasses, with its baselines unchanged.dist/index.d.tsanddist/index.d.ctsare byte-identical torefactor/112-scene-labels, and thenpm pack --dry-runfile list is unchanged.dist/index.jsshows relocation only.refactor/112-scene-labels, with that branch as the PR's base.navigator.tsis untouched.