imgui
imgui copied to clipboard
MixedValue item flag for DragScalars
This PR implements the WIP item flag ImGuiItemFlags_MixedValue
for drag scalars. When this flag is set, drag scalars will show a "-" to indicate a mixed value, and report a change even when typing the original value into the box.
Use this flag to indicate the drag scalar currently represents multiple values. The following code sample shows how to use it:
#include "imgui.h"
#include "imgui_internal.h"
// ...
void OnGui()
{
static bool isMixed = true;
static float fVal = 0.0f;
if (isMixed)
{
ImGui::PushItemFlag(ImGuiItemFlags_MixedValue, true);
if (ImGui::DragFloat("Example", &fVal))
{
isMixed = false;
}
ImGui::PopItemFlag();
}
else
{
ImGui::DragFloat("Example", &fVal);
}
}
This works for anything based on DragScalar()
(DragFloat()
, DragInt4()
, etc.).