| ... | ... | @@ -61,6 +61,15 @@ export function AssistantSelectionToolbar({ |
| 61 | 61 | return; |
| 62 | 62 | } |
| 63 | 63 | const rects = captured.range.getClientRects(); |
| 64 | const pointerOnText = |
| 65 | pointer !== null && |
| 66 | Array.from(rects).some( |
| 67 | (line) => |
| 68 | pointer.x >= line.left - 8 && |
| 69 | pointer.x <= line.right + 8 && |
| 70 | pointer.y >= line.top - 8 && |
| 71 | pointer.y <= line.bottom + 8, |
| 72 | ); |
| 64 | 73 | setSelection({ |
| 65 | 74 | sourceAnchor: { source: captured.source, range: captured.range, viewport }, |
| 66 | 75 | citation: { |
| ... | ... | @@ -72,7 +81,7 @@ export function AssistantSelectionToolbar({ |
| 72 | 81 | position: resolveSelectionActionPosition({ |
| 73 | 82 | bounds: viewportRect, |
| 74 | 83 | selectionRect: rects.item(rects.length - 1) ?? rect, |
| 75 | | pointer, |
| 84 | pointer: pointerOnText ? pointer : null, |
| 76 | 85 | viewport: { width: window.innerWidth, height: window.innerHeight }, |
| 77 | 86 | }), |
| 78 | 87 | }); |