LinkHighlightingNode: fix X-edge snap unreachable after midY snap

In drawRectsImageContent's modern path the snap loop runs midY
trimming first, leaving rects[i].maxY == rects[i+1].minY for
adjacent line rects. The X-edge snap guard then evaluated
rects[i].insetBy(dx: 0.0, dy: 1.0).intersects(rects[i+1]) — but
positive dy shrinks the rect, so after the trim the guarded
rectangle no longer intersects its neighbor (CGRect.intersects
requires positive-area overlap). Flip dy to -1.0 so the temp
rect grows and touching neighbors satisfy the guard.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
isaac 2026-05-02 11:44:05 +02:00
parent 6e318f314e
commit d1c5d66bd3

View file

@ -82,7 +82,7 @@ private func drawRectsImageContent(size: CGSize, context: CGContext, color: UICo
rects[i + 1].size.height = rects[i + 1].maxY - midY
hadChanges = true
}
if rects[i].maxY >= rects[i + 1].minY && rects[i].insetBy(dx: 0.0, dy: 1.0).intersects(rects[i + 1]) {
if rects[i].maxY >= rects[i + 1].minY && rects[i].insetBy(dx: 0.0, dy: -1.0).intersects(rects[i + 1]) {
if abs(rects[i].minX - rects[i + 1].minX) < minRadius {
let commonMinX = min(rects[i].origin.x, rects[i + 1].origin.x)
if rects[i].origin.x != commonMinX {