Skip to content

Commit

Permalink
Add ui link disconnect logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
linuscu committed Aug 23, 2024
1 parent 4c99ba2 commit f458500
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/rendering/source/common/ui/UIVisitors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,16 @@ namespace l::ui {
return true;
}
}
if (container.HasConfigFlag(UIContainer_LinkFlag) && !mDragging && input.mStarted && mLinkContainer.get() == nullptr && container.GetCoParent() != nullptr) {
ImVec2 pCenter = container.GetCoParent()->GetPosition();
ImVec2 size = container.GetCoParent()->GetSize();
ImVec2 pT = container.GetCoParent()->GetLayoutArea().Transform(pCenter, input.mRootPos);
if (OverlapCircle(input.mCurPos, pT, size.x * container.GetCoParent()->GetLayoutArea().mScale)) {
mDragging = true;
mLinkContainer.mContainer = &container;
return true;
}
}

if (mDragging && mLinkContainer.get() != nullptr && container.HasConfigFlag(UIContainer_LinkFlag) && mLinkContainer.get() == &container) {
// On the newly created link container, drag the end point along the mouse movement
Expand Down

0 comments on commit f458500

Please sign in to comment.