Skip to content

Commit

Permalink
[FIX] : fix about the canvas pos where the node must be created
Browse files Browse the repository at this point in the history
  • Loading branch information
aiekick committed Dec 30, 2023
1 parent 9ca2634 commit 34e93a4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions libs/LumoBackend/src/Graph/Base/BaseNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ void BaseNode::NavigateToSelection() const {
//////////////////////////////////////////////////////////////////////////////

ImVec2 BaseNode::GetMousePos() const {
return ImGui::GetMousePosOnOpeningCurrentPopup();
//return ImGui::GetMousePosOnOpeningCurrentPopup();
return ImGui::GetMousePos();
}

Expand Down Expand Up @@ -1344,24 +1344,25 @@ void BaseNode::DoShorcutsOnNode(BaseNodeState* vBaseNodeState) {
}

void BaseNode::DoPopups(BaseNodeState* vBaseNodeState) {
const auto& mouse_pos = GetMousePos();

ax::NodeEditor::Suspend();

if (vBaseNodeState->m_CustomContextMenuRequested && !vBaseNodeState->m_CustomContextMenuNode.expired()) {
m_OpenPopupPosition = GetMousePos();
m_OpenPopupPosition = mouse_pos;
ImGui::OpenPopup("CustomNodePopup");
vBaseNodeState->m_CustomContextMenuRequested = false;
} else if (ax::NodeEditor::ShowNodeContextMenu(&m_ContextMenuNodeId)) {
m_OpenPopupPosition = GetMousePos();
m_OpenPopupPosition = mouse_pos;
ImGui::OpenPopup("NodeContextMenu");
} else if (ax::NodeEditor::ShowPinContextMenu(&m_ContextMenuSlotId)) {
m_OpenPopupPosition = GetMousePos();
m_OpenPopupPosition = mouse_pos;
ImGui::OpenPopup("SlotContextMenu");
} else if (ax::NodeEditor::ShowLinkContextMenu(&m_ContextMenuLinkId)) {
m_OpenPopupPosition = GetMousePos();
m_OpenPopupPosition = mouse_pos;
ImGui::OpenPopup("LinkContextMenu");
} else if (ax::NodeEditor::ShowBackgroundContextMenu()) {
m_OpenPopupPosition = GetMousePos();
m_OpenPopupPosition = mouse_pos;
vBaseNodeState->linkFromSlot.reset();
ImGui::OpenPopup("CreateNewNode");
}
Expand Down

0 comments on commit 34e93a4

Please sign in to comment.