From 424c039b7eb5ff40776c86189a2c4aa26b48de84 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Thu, 11 May 2023 19:03:41 +0200 Subject: [PATCH] More precise testing of edges on mouse hit - without this patch, the selected objects in dense regions are not at the mouse pointer's tip, but somewhat away --- src/laybasic/laybasic/layFinder.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/laybasic/laybasic/layFinder.cc b/src/laybasic/laybasic/layFinder.cc index acb79f9f5..168efce12 100644 --- a/src/laybasic/laybasic/layFinder.cc +++ b/src/laybasic/laybasic/layFinder.cc @@ -137,8 +137,11 @@ Finder::test_edge (const db::ICplxTrans &trans, const db::Edge &edg, double &dis double d1 = p1.double_distance (m_region.center ()); double d2 = p2.double_distance (m_region.center ()); - // snap to the point - nothing can get closer - distance = 0.0; + double d = std::min (d1, d2); + if (! match || d < distance) { + distance = d; + } + if (d1 < d2) { ret = 1; } else {