Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Add] Suspend/Resume Canvas Zoom by desactivating Navigation #220

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions imgui_node_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,9 @@ int BreakLinks(PinId pinId); // Break all links connected to this pin
void NavigateToContent(float duration = -1);
void NavigateToSelection(bool zoomIn = false, float duration = -1);

void SuspendNavigation();
void ResumeNavigation();

bool ShowNodeContextMenu(NodeId* nodeId);
bool ShowPinContextMenu(PinId* pinId);
bool ShowLinkContextMenu(LinkId* linkId);
Expand Down
10 changes: 10 additions & 0 deletions imgui_node_editor_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,16 @@ void ax::NodeEditor::NavigateToSelection(bool zoomIn, float duration)
s_Editor->NavigateTo(s_Editor->GetSelectionBounds(), zoomIn, duration);
}

void ax::NodeEditor::SuspendNavigation()
{
s_Editor->SuspendNavigation();
}

void ax::NodeEditor::ResumeNavigation()
{
s_Editor->ResumeNavigation();
}

bool ax::NodeEditor::ShowNodeContextMenu(NodeId* nodeId)
{
return s_Editor->GetContextMenu().ShowNodeContextMenu(nodeId);
Expand Down
10 changes: 10 additions & 0 deletions imgui_node_editor_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -1433,6 +1433,16 @@ struct EditorContext
m_NavigateAction.NavigateTo(bounds, zoomMode, duration);
}

inline void SuspendNavigation()
{
m_NavigateAction.m_IsActive = false;
}

inline void ResumeNavigation()
{
m_NavigateAction.m_IsActive = true;
}

void RegisterAnimation(Animation* animation);
void UnregisterAnimation(Animation* animation);

Expand Down