From 25c675e89e5547cf4b3dce722026c455889a06c8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 03:20:14 +0000 Subject: [PATCH 1/2] Initial plan From 2a03dd21bb2774454c94f2eb4a7641bf27d7d955 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 03:27:09 +0000 Subject: [PATCH 2/2] Optimize Group::select() with short-circuit checks before positionEdgeVariables() Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com> --- model/group.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/model/group.cc b/model/group.cc index 24db70eaf..167aac504 100644 --- a/model/group.cc +++ b/model/group.cc @@ -1222,6 +1222,20 @@ namespace minsky ItemPtr Group::select(float x, float y) const { + // Short-circuit: no edge variables to hit-test. + if (inVariables.empty() && outVariables.empty()) + return nullptr; + + // Short-circuit: avoid the expensive positionEdgeVariables() call when + // (x,y) is clearly outside the expanded group bounding box. Using + // w+h as the conservative AABB half-extent covers all rotation angles. + const float z = zoomFactor(); + const float w = 0.5f * iWidth() * z; + const float h = 0.5f * iHeight() * z + topMargin * z; + const float maxExtent = w + h; + if (abs(x - this->x()) > maxExtent || abs(y - this->y()) > maxExtent) + return nullptr; + // Ensure edge variable positions are up-to-date before hit-testing. // (Positions are otherwise only set during draw1edge() in a render pass.) positionEdgeVariables();