Compare commits

...
Author SHA1 Message Date
Abimael MartellandClaude Fable 5 60a46d0726 fix(extractor): use center-y for off-box link filtering
Link items carry an annotation rect, so y is a box edge — unlike text
items, where y is a baseline. Testing rect-bottom dropped partially
visible links whose bottom edge dipped past the tolerance. Follow-up
to a #160 review comment.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 01:11:41 -07:00
+5 -1
View File
@@ -303,7 +303,11 @@ fn extract_positioned_text_impl(
if let Some((bx0, by0, bx1, by1)) = clipped_box {
links.retain(|it| {
let cx = it.x + it.width / 2.0;
cx >= bx0 - 6.0 && cx <= bx1 + 6.0 && it.y >= by0 - 6.0 && it.y <= by1 + 6.0
// Center-y, not it.y: link items carry an annotation rect,
// so y is a box edge — unlike text items, where y is a
// baseline and testing it directly is the natural semantics.
let cy = it.y + it.height / 2.0;
cx >= bx0 - 6.0 && cx <= bx1 + 6.0 && cy >= by0 - 6.0 && cy <= by1 + 6.0
});
}
all_items.extend(links);