Disable window move with drag event on image


#1

I’m displaying an image with ImGUI like this:
ImGui::Begin(“Full image”, nullptr, ImGuiWindowFlags_HorizontalScrollbar);
ImVec2 size(imageWidth, imageHeight);
ImGui::Image(imageTexture, size);
ImGui::End();
I would like to alter the behavior of drag event on the “Full image” window so that when I click and drag on the image, the window won’t change its position. Other Imgui windows should keep behaving as usual. Can this be toggled with a setting?


#2

You can use ImageButton() or an InvisibleButton().

You may also set io.ConfigWindowsMoveFromTitleBarOnly=true as a global configuration to disable moving from clicking on void.