Skip to content

Commit 5513afb

Browse files
Fix itemAt to return edge I/O variables directly instead of groups
When clicking on edge I/O variables, itemAt now checks group.select() and returns the variable directly, rather than returning the group. This ensures itemFocus is set to the variable, allowing wire dragging to work correctly. Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
1 parent cb38475 commit 5513afb

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

model/canvas.cc

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,17 @@ namespace minsky
426426
return false;
427427
});
428428
if (!item)
429-
item=model->findAny
430-
(&Group::groups, [&](const GroupPtr& i)
431-
{return i->visible() && i->clickType(x,y)!=ClickType::outside;});
429+
{
430+
// Check if clicking on a group's edge I/O variable
431+
if (auto g=model->findAny
432+
(&Group::groups, [&](const GroupPtr& i)
433+
{return i->visible() && i->select(x,y);}))
434+
if (auto selected=g->select(x,y))
435+
return selected;
436+
item=model->findAny
437+
(&Group::groups, [&](const GroupPtr& i)
438+
{return i->visible() && i->clickType(x,y)!=ClickType::outside;});
439+
}
432440
return item;
433441
}
434442

0 commit comments

Comments
 (0)