ImGuizmo
ImGuizmo copied to clipboard
CanActivate needs rethinking
I have integrated ImGuizmo into several projects by now. A recurring theme is me doing this:
static bool CanActivate()
{
if (ImGui::IsMouseClicked(0) && /*!ImGui::IsAnyItemHovered() &&*/ !ImGui::IsAnyItemActive())
{
return true;
}
return false;
}
This is required for applications that render imguizmo-controlled viewport into a texture and use InvisibleButton()
over that texture to prevent window from getting dragged when grabbing this viewport.
Do you think it would be safe to permanently remove IsAnyItemHovered()
check? Or do we need to make this behavior customizable by the user?
I'd go with a #define in the .h to enable/disable that call. with a comment to explain your use case. As it doesn't need a runtime flag.
One possible way to mitigate this is by setting ConfigWindowsMoveFromTitleBarOnly
to true
:
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
io.ConfigWindowsMoveFromTitleBarOnly = true;
// ...
It still drags a Dear ImGui window around if both the title bar and the gizmo overlap, but at least now there are less chances of that happening.