imgui-node-editor icon indicating copy to clipboard operation
imgui-node-editor copied to clipboard

[Add] Suspend/Resume Canvas Zoom by desactivating Navigation

Open LittleCoinCoin opened this issue 2 years ago • 0 comments

Major:

  • Using NavigateAction::m_IsActive boolean (m_NavigateAction of the EditorContext)
  • Added methods To gloabal API to directly set it to true (ResumeNavigation) or false (SuspendNavigation).
  • As a result, we can call the couple Suspend/Resume to momentarily deactivate the canvas zoom.

Use Case Example

When hovering over a ListBox (this is a custom to my project), I can call ax::NodeEditor::SuspendNavigation() before a portion of code that wants to use the ImGui::GetIO().MouseWheel input. Then, I call ax::NodeEditor::ResumeNavigation().

Pseudo-code

if (isListBoxHovered())
{
    ax::NodeEditor::SuspendNavigation();
    
    //handle list box scrolling
    
    ax::NodeEditor::ResumeNavigation();
}

NodeEditorZoomSuspendResume

LittleCoinCoin avatar May 02 '23 09:05 LittleCoinCoin