mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 03:47:00 +00:00
This commit is contained in:
parent
fbabf651f4
commit
324e0310ad
@ -43,6 +43,7 @@ Breaking Changes:
|
||||
If you used DisplayOffset it was probably in association to rasterizing a font at a specific size,
|
||||
in which case the corresponding offset may be reported into GlyphOffset. (#1619)
|
||||
- Style: Renamed style.TabMinWidthForUnselectedCloseButton to style.TabMinWidthForCloseButton.
|
||||
- Renamed ImGuiSliderFlags_ClampOnInput to ImGuiSliderFlags_AlwaysClamp. Kept redirection enum (will obsolete).
|
||||
- Renamed OpenPopupContextItem() back to OpenPopupOnItemClick(), REVERTED CHANGE FROM 1.77.
|
||||
For variety of reason this is more self-explanatory.
|
||||
- Removed return value from OpenPopupOnItemClick() - returned true on mouse release on item - because it
|
||||
@ -161,6 +162,7 @@ Other Changes:
|
||||
which was obsoleted. (#1823, #1316, #642) [@Shironekoben, @AndrewBelt]
|
||||
- Added ImGuiSliderFlags_ClampOnInput flag to force clamping value when using
|
||||
CTRL+Click to type in a value manually. (#1829, #3209, #946, #413).
|
||||
[note: RENAMED to ImGuiSliderFlags_AlwaysClamp in 1.79].
|
||||
- Added ImGuiSliderFlags_NoRoundToFormat flag to disable rounding underlying
|
||||
value to match precision of the display format string. (#642)
|
||||
- Added ImGuiSliderFlags_NoInput flag to disable turning widget into a text input
|
||||
|
@ -372,6 +372,7 @@ CODE
|
||||
When you are not sure about a old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
||||
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
||||
|
||||
- 2020/09/25 (1.79) - renamed ImGuiSliderFlags_ClampOnInput to ImGuiSliderFlags_AlwaysClamp. Kept redirection enum (will obsolete sooner because previous name was added recently).
|
||||
- 2020/09/25 (1.79) - renamed style.TabMinWidthForUnselectedCloseButton to style.TabMinWidthForCloseButton.
|
||||
- 2020/09/21 (1.79) - renamed OpenPopupContextItem() back to OpenPopupOnItemClick(), reverting the change from 1.77. For varieties of reason this is more self-explanatory.
|
||||
- 2020/09/21 (1.79) - removed return value from OpenPopupOnItemClick() - returned true on mouse release on item - because it is inconsistent with other popup APIs and makes others misleading. It's also and unnecessary: you can use IsWindowAppearing() after BeginPopup() for a similar result.
|
||||
|
7
imgui.h
7
imgui.h
@ -1302,11 +1302,16 @@ enum ImGuiColorEditFlags_
|
||||
enum ImGuiSliderFlags_
|
||||
{
|
||||
ImGuiSliderFlags_None = 0,
|
||||
ImGuiSliderFlags_ClampOnInput = 1 << 4, // Clamp value to min/max bounds when input manually with CTRL+Click. By default CTRL+Click allows going out of bounds.
|
||||
ImGuiSliderFlags_AlwaysClamp = 1 << 4, // Clamp value to min/max bounds when input manually with CTRL+Click. By default CTRL+Click allows going out of bounds.
|
||||
ImGuiSliderFlags_Logarithmic = 1 << 5, // Make the widget logarithmic (linear otherwise). Consider using ImGuiSliderFlags_NoRoundToFormat with this if using a format-string with small amount of digits.
|
||||
ImGuiSliderFlags_NoRoundToFormat = 1 << 6, // Disable rounding underlying value to match precision of the display format string (e.g. %.3f values are rounded to those 3 digits)
|
||||
ImGuiSliderFlags_NoInput = 1 << 7, // Disable CTRL+Click or Enter key allowing to input text directly into the widget
|
||||
ImGuiSliderFlags_InvalidMask_ = 0x7000000F // [Internal] We treat using those bits as being potentially a 'float power' argument from the previous API that has got miscast to this enum, and will trigger an assert if needed.
|
||||
|
||||
// Obsolete names (will be removed)
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
, ImGuiSliderFlags_ClampOnInput = ImGuiSliderFlags_AlwaysClamp, // [renamed in 1.79]
|
||||
#endif
|
||||
};
|
||||
|
||||
// Identify a mouse button.
|
||||
|
@ -617,7 +617,7 @@ static void ShowDemoWindowWidgets()
|
||||
"Hold SHIFT/ALT for faster/slower edit.\n"
|
||||
"Double-click or CTRL+click to input value.");
|
||||
|
||||
ImGui::DragInt("drag int 0..100", &i2, 1, 0, 100, "%d%%", ImGuiSliderFlags_ClampOnInput);
|
||||
ImGui::DragInt("drag int 0..100", &i2, 1, 0, 100, "%d%%", ImGuiSliderFlags_AlwaysClamp);
|
||||
|
||||
static float f1 = 1.00f, f2 = 0.0067f;
|
||||
ImGui::DragFloat("drag float", &f1, 0.005f);
|
||||
@ -1558,7 +1558,7 @@ static void ShowDemoWindowWidgets()
|
||||
{
|
||||
// Demonstrate using advanced flags for DragXXX and SliderXXX functions. Note that the flags are the same!
|
||||
static ImGuiSliderFlags flags = ImGuiSliderFlags_None;
|
||||
ImGui::CheckboxFlags("ImGuiSliderFlags_ClampOnInput", (unsigned int*)&flags, ImGuiSliderFlags_ClampOnInput);
|
||||
ImGui::CheckboxFlags("ImGuiSliderFlags_AlwaysClamp", (unsigned int*)&flags, ImGuiSliderFlags_AlwaysClamp);
|
||||
ImGui::SameLine(); HelpMarker("Always clamp value to min/max bounds (if any) when input manually with CTRL+Click.");
|
||||
ImGui::CheckboxFlags("ImGuiSliderFlags_Logarithmic", (unsigned int*)&flags, ImGuiSliderFlags_Logarithmic);
|
||||
ImGui::SameLine(); HelpMarker("Enable logarithmic editing (more precision for small values).");
|
||||
@ -1591,7 +1591,7 @@ static void ShowDemoWindowWidgets()
|
||||
{
|
||||
static float begin = 10, end = 90;
|
||||
static int begin_i = 100, end_i = 1000;
|
||||
ImGui::DragFloatRange2("range float", &begin, &end, 0.25f, 0.0f, 100.0f, "Min: %.1f %%", "Max: %.1f %%", ImGuiSliderFlags_ClampOnInput);
|
||||
ImGui::DragFloatRange2("range float", &begin, &end, 0.25f, 0.0f, 100.0f, "Min: %.1f %%", "Max: %.1f %%", ImGuiSliderFlags_AlwaysClamp);
|
||||
ImGui::DragIntRange2("range int", &begin_i, &end_i, 5, 0, 1000, "Min: %d units", "Max: %d units");
|
||||
ImGui::DragIntRange2("range int (no bounds)", &begin_i, &end_i, 5, 0, 0, "Min: %d units", "Max: %d units");
|
||||
ImGui::TreePop();
|
||||
@ -4029,9 +4029,9 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
||||
"rebuild the font atlas, and call style.ScaleAllSizes() on a reference ImGuiStyle structure.\n"
|
||||
"Using those settings here will give you poor quality results.");
|
||||
static float window_scale = 1.0f;
|
||||
if (ImGui::DragFloat("window scale", &window_scale, 0.005f, MIN_SCALE, MAX_SCALE, "%.2f", ImGuiSliderFlags_ClampOnInput)) // Scale only this window
|
||||
if (ImGui::DragFloat("window scale", &window_scale, 0.005f, MIN_SCALE, MAX_SCALE, "%.2f", ImGuiSliderFlags_AlwaysClamp)) // Scale only this window
|
||||
ImGui::SetWindowFontScale(window_scale);
|
||||
ImGui::DragFloat("global scale", &io.FontGlobalScale, 0.005f, MIN_SCALE, MAX_SCALE, "%.2f", ImGuiSliderFlags_ClampOnInput); // Scale everything
|
||||
ImGui::DragFloat("global scale", &io.FontGlobalScale, 0.005f, MIN_SCALE, MAX_SCALE, "%.2f", ImGuiSliderFlags_AlwaysClamp); // Scale everything
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
ImGui::EndTabItem();
|
||||
|
@ -2242,8 +2242,8 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* p_data,
|
||||
|
||||
if (temp_input_is_active)
|
||||
{
|
||||
// Only clamp CTRL+Click input when ImGuiSliderFlags_ClampInput is set
|
||||
const bool is_clamp_input = (flags & ImGuiSliderFlags_ClampOnInput) != 0 && (p_min == NULL || p_max == NULL || DataTypeCompare(data_type, p_min, p_max) < 0);
|
||||
// Only clamp CTRL+Click input when ImGuiSliderFlags_AlwaysClamp is set
|
||||
const bool is_clamp_input = (flags & ImGuiSliderFlags_AlwaysClamp) != 0 && (p_min == NULL || p_max == NULL || DataTypeCompare(data_type, p_min, p_max) < 0);
|
||||
return TempInputScalar(frame_bb, id, label, data_type, p_data, format, is_clamp_input ? p_min : NULL, is_clamp_input ? p_max : NULL);
|
||||
}
|
||||
|
||||
@ -2324,7 +2324,7 @@ bool ImGui::DragFloat4(const char* label, float v[4], float v_speed, float v_min
|
||||
return DragScalarN(label, ImGuiDataType_Float, v, 4, v_speed, &v_min, &v_max, format, flags);
|
||||
}
|
||||
|
||||
// NB: You likely want to specify the ImGuiSliderFlags_ClampOnInput when using this.
|
||||
// NB: You likely want to specify the ImGuiSliderFlags_AlwaysClamp when using this.
|
||||
bool ImGui::DragFloatRange2(const char* label, float* v_current_min, float* v_current_max, float v_speed, float v_min, float v_max, const char* format, const char* format_max, ImGuiSliderFlags flags)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
@ -2377,7 +2377,7 @@ bool ImGui::DragInt4(const char* label, int v[4], float v_speed, int v_min, int
|
||||
return DragScalarN(label, ImGuiDataType_S32, v, 4, v_speed, &v_min, &v_max, format, flags);
|
||||
}
|
||||
|
||||
// NB: You likely want to specify the ImGuiSliderFlags_ClampOnInput when using this.
|
||||
// NB: You likely want to specify the ImGuiSliderFlags_AlwaysClamp when using this.
|
||||
bool ImGui::DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed, int v_min, int v_max, const char* format, const char* format_max, ImGuiSliderFlags flags)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
@ -2849,8 +2849,8 @@ bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* p_dat
|
||||
|
||||
if (temp_input_is_active)
|
||||
{
|
||||
// Only clamp CTRL+Click input when ImGuiSliderFlags_ClampInput is set
|
||||
const bool is_clamp_input = (flags & ImGuiSliderFlags_ClampOnInput) != 0;
|
||||
// Only clamp CTRL+Click input when ImGuiSliderFlags_AlwaysClamp is set
|
||||
const bool is_clamp_input = (flags & ImGuiSliderFlags_AlwaysClamp) != 0;
|
||||
return TempInputScalar(frame_bb, id, label, data_type, p_data, format, is_clamp_input ? p_min : NULL, is_clamp_input ? p_max : NULL);
|
||||
}
|
||||
|
||||
@ -3178,8 +3178,7 @@ bool ImGui::TempInputText(const ImRect& bb, ImGuiID id, const char* label, char*
|
||||
return value_changed;
|
||||
}
|
||||
|
||||
// Note that Drag/Slider functions are only forwarding the min/max values clamping values if the
|
||||
// ImGuiSliderFlags_ClampOnInput / ImGuiSliderFlags_ClampOnInput flag is set!
|
||||
// Note that Drag/Slider functions are only forwarding the min/max values clamping values if the ImGuiSliderFlags_AlwaysClamp flag is set!
|
||||
// This is intended: this way we allow CTRL+Click manual input to set a value out of bounds, for maximum flexibility.
|
||||
// However this may not be ideal for all uses, as some user code may break on out of bound values.
|
||||
bool ImGui::TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImGuiDataType data_type, void* p_data, const char* format, const void* p_clamp_min, const void* p_clamp_max)
|
||||
|
Loading…
Reference in New Issue
Block a user