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

Disable mouse interaction

Open Namek opened this issue 3 years ago • 1 comments

Ho, I would like to disable mouse interaction when custom mouse interaction happens. In the example below I want to drag item out of the list:

imgui-node-editor-custom-drag

Node selection should be turned off. Any ideas? Even if I had to modify the library?

Namek avatar Jul 22 '22 16:07 Namek

It does not really solves the problem, but you can rebind mouse buttons:

NodeEditor::Config cfg;
cfg.DragButtonIndex = 0;
cfg.SelectButtonIndex = 1;
cfg.NavigateButtonIndex = 2;
cfg.ContextMenuButtonIndex = 1;
NodeEditor::EditorContext* ctx = NodeEditor::CreateEditor(&cfg);

MultiPain avatar Jul 23 '22 04:07 MultiPain

@Namek Do I understand correctly that the problem is selection rectangle appearing here?

thedmd avatar Aug 12 '22 21:08 thedmd

@thedmd yes as for now I used the suggestion above but it's not ideal

Namek avatar Aug 13 '22 09:08 Namek

Can you by any chance provide a code sample I can play with to reproduce the issue?

thedmd avatar Aug 21 '22 15:08 thedmd

@thedmd ~this issue persist only in develop branch, no problems in master.~ (see comment below)

Can you by any chance provide a code sample I can play with to reproduce the issue?

There is nothing special 😃

void NodesDemo::Draw()
{
	static float number = 0.0f;
	unsigned int id = 0;
	
	NodeEditor::Begin("MyEditor");
	
	NodeEditor::BeginNode(id++);
	ImGui::Text("Test node");

	ImGui::PushItemWidth(64.0f);
	ImGui::DragFloat("test", &number);
	ImGui::PopItemWidth();

	NodeEditor::EndNode();

	NodeEditor::End();
}

MultiPain avatar Aug 24 '22 06:08 MultiPain

Actually, there is something wrong with d&d in master... nodes

MultiPain avatar Aug 24 '22 06:08 MultiPain

I pushed a fix. Can you confirm if it work for you d&d case too?

thedmd avatar Aug 25 '22 03:08 thedmd

@thedmd works fine for me 👍

MultiPain avatar Aug 25 '22 07:08 MultiPain