@@ -59,6 +59,7 @@ export function createAnchors(dependencies) {
5959 pageWords,
6060 paintThreadQuotes,
6161 panel,
62+ pointerAt,
6263 quoteFrom,
6364 queueLegend,
6465 rangeOf,
@@ -600,6 +601,7 @@ export function createAnchors(dependencies) {
600601 const item = aimedItem ( ) ;
601602 return item ? { el : item , part : "" } : null ;
602603 }
604+ const pointer = pointerAt ( ) ;
603605 if ( designIsOn ( ) && pointer . x >= 0 )
604606 return designTarget ( document . elementFromPoint ( pointer . x , pointer . y ) ) ;
605607 return null ;
@@ -655,7 +657,6 @@ export function createAnchors(dependencies) {
655657 inspectEl . style . left = `${ Math . max ( 2 , corner . left ) } px` ;
656658 inspectEl . style . top = `${ ( above >= 0 ? above : corner . top + 2 ) + pageScroller . scrollTop } px` ;
657659 }
658- const pointer = { x : - 1 , y : - 1 } ; // last seen, so a repaint can re-answer the hover
659660 let hovering = null ;
660661 let hoverQueued = false ;
661662 const marksOf = ( id ) => marked . get ( id ) ?? [ ] ;
@@ -1261,6 +1262,7 @@ export function createAnchors(dependencies) {
12611262 // panel already says for itself, on the quote that makes it. Unconditional because
12621263 // toggle runs no update step when the answer has not changed, unlike the add that
12631264 // noteMarks and the standing paint have to guard.
1265+ const pointer = pointerAt ( ) ;
12641266 const onMark = markAt ( pointer . x , pointer . y ) ;
12651267 document . body . classList . toggle ( "lf-over-mark" , Boolean ( onMark ) ) ;
12661268 const id = hoveredThreadOf ( ) ?. dataset . id ?? onMark ;
@@ -1270,32 +1272,9 @@ export function createAnchors(dependencies) {
12701272 if ( id !== hovering || hoverCardOf ( id ) !== hoverThread ) paintHover ( id ) ;
12711273 } ) ;
12721274 }
1273- // The pointer's place is read off a pointer event and not off `mousemove`, because the
1274- // legacy mouse events round clientX/clientY to whole pixels and the browser hit-tests the
1275- // position they were rounded from. Every consumer of this record asks a hit-test question
1276- // — what a press would take, whether a mark is under the hand — so a rounded point is an
1277- // answer about somewhere the pointer is not, and within a pixel of a boundary it is a
1278- // different element: an ⌥ aim outlined the option above the one the press then took,
1279- // because the outline asked elementFromPoint at the rounded point while the press read
1280- // the target the browser resolved at the true one.
1281- document . addEventListener ( "pointermove" , ( ev ) => {
1282- pointer . x = ev . clientX ;
1283- pointer . y = ev . clientY ;
1284- refreshHover ( ) ;
1285- } ) ;
1286- // A finger arrives already down. A tap dispatches `pointerdown` and then the
1287- // compatibility mouse events — no `pointermove` anywhere in it — so a record kept from
1288- // movement alone is still its start value when the click asks, and a consumer with no
1289- // guard asks elementFromPoint about a point off the page: the quote under the finger
1290- // opened nothing. The press is the pointer's place too, and for a tap it is the only
1291- // statement of it: a drag still dispatches `pointermove` until the browser cancels it.
1292- // No hover refresh with it — a mouse has already moved to this point and refreshed
1293- // there — which is not a claim that the record paints no hover on touch. pageShifted
1294- // reads it too, and a drag reached that paint before this recorder existed.
1295- document . addEventListener ( "pointerdown" , ( ev ) => {
1296- pointer . x = ev . clientX ;
1297- pointer . y = ev . clientY ;
1298- } ) ;
1275+ // The shared pointer recorder is installed before this listener, so the hover reads the
1276+ // same unrounded point the browser used for the event's hit test.
1277+ document . addEventListener ( "pointermove" , refreshHover ) ;
12991278 // The page moving under a parked pointer is the pointer moving over the page: what a
13001279 // press would take, whether a mark is under the hand, and where every legend box
13011280 // stands can all change with no mouse event to say so, and a box left over the old
@@ -1347,7 +1326,6 @@ export function createAnchors(dependencies) {
13471326 refreshAim,
13481327 dockSeats,
13491328 paintAnchors,
1350- pointer,
13511329 fragmentId,
13521330 markAt,
13531331 scrollToElement,
0 commit comments