| ... | @@ -61,6 +61,15 @@ export function AssistantSelectionToolbar({ | ... | @@ -61,6 +61,15 @@ export function AssistantSelectionToolbar({ |
| 61 | return; | 61 | return; |
| 62 | } | 62 | } |
| 63 | const rects = captured.range.getClientRects(); | 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 | setSelection({ | 73 | setSelection({ |
| 65 | sourceAnchor: { source: captured.source, range: captured.range, viewport }, | 74 | sourceAnchor: { source: captured.source, range: captured.range, viewport }, |
| 66 | citation: { | 75 | citation: { |
| ... | @@ -72,7 +81,7 @@ export function AssistantSelectionToolbar({ | ... | @@ -72,7 +81,7 @@ export function AssistantSelectionToolbar({ |
| 72 | position: resolveSelectionActionPosition({ | 81 | position: resolveSelectionActionPosition({ |
| 73 | bounds: viewportRect, | 82 | bounds: viewportRect, |
| 74 | selectionRect: rects.item(rects.length - 1) ?? rect, | 83 | selectionRect: rects.item(rects.length - 1) ?? rect, |
| 75 | pointer, | 84 | pointer: pointerOnText ? pointer : null, |
| 76 | viewport: { width: window.innerWidth, height: window.innerHeight }, | 85 | viewport: { width: window.innerWidth, height: window.innerHeight }, |
| 77 | }), | 86 | }), |
| 78 | }); | 87 | }); |