LearnNewsExamplesServices
Frontmatter
id19305
titleA press overtakes its coalesced mousemove, so a click orbits GraphScene
stateClosed
labels
bugaicore
assigneesneo-opus-grace
createdAtSep 27, 2026, 1:49 AM
updatedAtSep 27, 2026, 10:46 AM
githubUrlhttps://github.com/neomjs/neo/issues/19305
authorneo-opus-grace
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 27, 2026, 10:46 AM

A press overtakes its coalesced mousemove, so a click orbits GraphScene

neo-opus-grace
neo-opus-grace commented on Sep 27, 2026, 1:49 AM

Context

Found while wiring click selection into the Institution's Observatory (neomjs/neo-agent-institution#271, PR neomjs/neo-agent-institution#272), whose renderer extends Neo.canvas.GraphScene. An NL arm that clicked a node after an orbit and a zoom selected nothing. The node had been orbited away at the press.

Probe (Institution NL harness, engine a50ae57ce8): the pointer rests at A for 200 ms, then page.mouse.click(B) jumps 400 px right and 200 px down and presses within one frame. The camera went from {yaw: 0.7, pitch: 0.32, touched: false} to {yaw: 3.1, pitch: 1.45, touched: true}: 400 px × orbitSpeed 0.006 = 2.4 rad of yaw, and pitch clamped at 1.45. One click rotated the scene by 2.4 rad.

The Problem

src/main/DomEvents.mjs coalesces mousemove into the next animation frame. onMouseMove stores lastMouseMoveData and schedules flushMouseMove with requestAnimationFrame, the #8654 perf change. onMouseDown, onMouseUp, onClick, onWheel and onMouseLeave send at once. A move and a press inside one frame therefore reach the App worker as press-then-move.

Neo.canvas.Base#updateMouseState derives dx/dy from the last reported position. The press report carries the whole unreported jump with buttons: 1, and GraphScene#updateMouseState orbits on exactly that combination. The late move lands afterwards. The same ordering hands a canvas a move after its leave, which re-arms a pointer that has left. Real hands hit this with a fast flick-and-click inside one frame, and on touch, where a tap arrives at a new position with no move before it.

The Architectural Reality

  • DomEvents#onMouseMove / #flushMouseMove (the coalescing, mouseMoveReqId) and the press handlers onMouseDown, onMouseUp, onClick, onDoubleClick, onContextMenu, onWheel, onMouseEnter, onMouseLeave, each a direct sendMessageToApp.
  • Consumers relying on move-before-press order: Neo.app.SharedCanvas → Neo.canvas.Base#updateMouseState (dx/dy), Neo.canvas.GraphScene#updateMouseState (orbit), and any App-side listener pairing a move with the following press.
  • Existing spec surface: test/playwright/unit/main/DomEvents.spec.mjs.

The Fix

Before sending any other mouse event, DomEvents flushes a pending coalesced move: cancel mouseMoveReqId and call flushMouseMove() at the top of the press, release, click, wheel, context menu and enter/leave handlers, or in one helper they share. Moves stay coalesced to at most one per frame when nothing else intervenes. GraphScene needs no change once order holds.

Acceptance Criteria

  • AC-1: a pending coalesced mousemove reaches the App worker before a following mousedown, mouseup, click, dblclick, contextmenu, wheel, mouseenter or mouseleave (a DomEvents.spec arm with a stubbed sendMessageToApp and requestAnimationFrame, red on dev).
  • AC-2: with nothing intervening, moves inside one frame still send once, carrying the last position.
  • AC-3 (post-merge): on an engine pin carrying the fix, the Institution's Observatory NL selectNode helper drops its pointer rest, and the click still selects. The helper documents the workaround and cites this ticket. Owner: neomjs/neo-agent-institution#277 (the pin that carries this fix).

Out of Scope

  • Moving the drag sensors to Pointer Events (#17889).
  • Any change to GraphScene's orbit rule.

Related

#8654 (the coalescing), #19173 / #19179 (the canvas host's wheel/drag forwarding), neomjs/neo-agent-institution#272.

Live latest-open sweep: the latest 20 open neo issues at 2026-09-26T23:48Z hold no equivalent; gh search issues for mousemove / coalescing finds only #17889 (sensors, different surface). A2A: the latest 30 messages hold no claim on DomEvents. Memory Core: the coalescing's origin (#8654, 2026-01) records a perf rationale, not an ordering decision.

Origin Session ID: 6408fcd4-3571-4ec2-8009-b4dae5d18917 Retrieval Hint: "DomEvents coalesced mousemove press ordering GraphScene orbit on click"

tobiu referenced in commit e5d052c - "fix(main): a wheel the main thread keeps leaves the waiting move to its frame (#19305)" on Sep 27, 2026, 10:31 AM
tobiu referenced in commit 942b43c - "fix(main): every other mouse event sends a move still waiting for its frame first (#19305) (#19306) on Sep 27, 2026, 10:46 AM
tobiu closed this issue on Sep 27, 2026, 10:46 AM