mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-30 18:29:04 +08:00
Merge branch 'master' into docking
# Conflicts: # docs/CHANGELOG.txt
This commit is contained in:
commit
192196711a
@ -685,7 +685,13 @@ static int parse_version(void)
|
||||
return GL3W_ERROR_INIT;
|
||||
glGetIntegerv(GL_MAJOR_VERSION, &version.major);
|
||||
glGetIntegerv(GL_MINOR_VERSION, &version.minor);
|
||||
if (version.major < 3)
|
||||
if (version.major == 0 && version.minor == 0)
|
||||
{
|
||||
// Query GL_VERSION in desktop GL 2.x, the string will start with "<major>.<minor>"
|
||||
const char* gl_version = (const char*)glGetString(GL_VERSION);
|
||||
sscanf(gl_version, "%d.%d", &version.major, &version.minor);
|
||||
}
|
||||
if (version.major < 2)
|
||||
return GL3W_ERROR_OPENGL_VERSION;
|
||||
return GL3W_OK;
|
||||
}
|
||||
@ -709,7 +715,7 @@ int imgl3wInit2(GL3WGetProcAddressProc proc)
|
||||
|
||||
int imgl3wIsSupported(int major, int minor)
|
||||
{
|
||||
if (major < 3)
|
||||
if (major < 2)
|
||||
return 0;
|
||||
if (version.major == major)
|
||||
return version.minor >= minor;
|
||||
|
@ -99,29 +99,39 @@ Other changes:
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
VERSION 1.89.3 (In Progress)
|
||||
VERSION 1.89.3 (Released 2023-02-14)
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v1.89.3
|
||||
|
||||
Breaking Changes:
|
||||
|
||||
- Backends+Examples: SDL2: renamed all unnumbered references to "sdl" to "sdl2".
|
||||
This is in prevision for the future release of SDL3 (#6146)
|
||||
This is in prevision for the future release of SDL3 and its associated backend. (#6146)
|
||||
- imgui_impl_sdl.cpp -> imgui_impl_sdl2.cpp
|
||||
- imgui_impl_sdl.h -> imgui_impl_sdl2.h
|
||||
- example_sdl_xxxx/ -> example_sdl2_xxxx/ (folders and projects)
|
||||
|
||||
All changes:
|
||||
|
||||
- SeparatorText(): Added SeparatorText() widget. (#1643) [@phed, @ocornut]
|
||||
- Added to style: float SeparatorTextBorderSize.
|
||||
- Added to style: ImVec2 SeparatorTextAlign, SeparatorTextPadding.
|
||||
- Tables: Raised max Columns count from 64 to 512. (#6094, #5305, #4876, #3572)
|
||||
The previous limit was due to using 64-bit integers but we moved to bits-array
|
||||
and tweaked the system enough to ensure no performance loss.
|
||||
- Tables: Solved an ID conflict issue with multiple-instances of a same table,
|
||||
due to how unique table instance id was generated. (#6140) [@ocornut, @rodrigorc]
|
||||
- Inputs, Scrolling: Made horizontal scroll wheel and horizontal scroll direction consistent
|
||||
accross backends/os. (#4019, #6096, #1463) [@PathogenDavid, @ocornut, @rokups]
|
||||
across backends/os. (#4019, #6096, #1463) [@PathogenDavid, @ocornut, @rokups]
|
||||
- Clarified that 'wheel_y > 0.0f' scrolls Up, 'wheel_y > 0.0f' scrolls Down.
|
||||
Clarified that 'wheel_x > 0.0f' scrolls Left, 'wheel_x > 0.0f' scrolls Right.
|
||||
- Backends: Fixed horizontal scroll direction for Win32 and SDL backends. (#4019)
|
||||
- Shift+WheelY support on non-OSX machines was already correct. (#2424, #1463)
|
||||
(whereaas on OSX machines Shift+WheelY turns into WheelX at the OS level).
|
||||
- If you use a custom-backend, you should verify horizontal wheel direction.
|
||||
- Axises are flipped by OSX for mouse & touchpad when 'Natural Scrolling' is on.
|
||||
- Axises are flipped by Windows for touchpad when 'Settings->Touchpad->Down motion scrolls up' is on.
|
||||
(whereas on OSX machines Shift+WheelY turns into WheelX at the OS level).
|
||||
- If you use a custom backend, you should verify horizontal wheel direction.
|
||||
- Axises are flipped by OSX for mouse & touch-pad when 'Natural Scrolling' is on.
|
||||
- Axises are flipped by Windows for touch-pad when 'Settings->Touchpad->Down motion scrolls up' is on.
|
||||
- You can use 'Demo->Tools->Debug Log->IO" to visualize values submitted to Dear ImGui.
|
||||
- Known issues remaining with Emscripten:
|
||||
- The magnitude of wheeling values on Emscripten was improved but isn't perfect. (#6096)
|
||||
@ -131,14 +141,6 @@ All changes:
|
||||
to find a way to detect this and set io.ConfigMacOSXBehaviors manually (if you know a way
|
||||
let us know!), or offer the "OSX-style behavior" option to their user.
|
||||
- Window: Avoid rendering shapes for hidden resize grips.
|
||||
- SeparatorText(): Added SeparatorText() widget. (#1643) [@phed, @ocornut]
|
||||
- Added to style: float SeparatorTextBorderSize.
|
||||
- Added to style: ImVec2 SeparatorTextAlign, SeparatorTextPadding.
|
||||
- Tables: Raised max Columns count from 64 to 512. (#6094, #5305, #4876, #3572)
|
||||
The previous limit was due to using 64-bit integers but we moved to bits-array
|
||||
and tweaked the system enough to ensure no performance loss.
|
||||
- Tables: Solved an ID conflict issue with multiple-instances of a same table,
|
||||
due to how unique table instance id was generated. (#6140) [@ocornut, @rodrigorc]
|
||||
- Text: Fixed layouting of wrapped-text block skipping successive empty lines,
|
||||
regression from the fix in 1.89.2. (#5720, #5919)
|
||||
- Text: Fixed clipping of single-character "..." ellipsis (U+2026 or U+0085) when font
|
||||
@ -149,8 +151,11 @@ All changes:
|
||||
(Not adding Super+Delete to delete to up to end-of-line on OSX, as OSX doesn't have it)
|
||||
- InputText: On OSX, inhibit usage of Alt key to toggle menu when active (used for work skip).
|
||||
- Menus: Fixed layout of MenuItem()/BeginMenu() when label contains a '\n'. (#6116) [@imkcy9]
|
||||
- ColorEdit, ColorPicker: Fixed hue/saturation preservation logic from interfering with
|
||||
the displayed value (but not stored value) of others widgets instances. (#6155)
|
||||
- PlotHistogram, PlotLines: Passing negative sizes honor alignment like other widgets.
|
||||
- Combo: Allow SetNextWindowSize() to alter combo popup size. (#6130)
|
||||
- Fonts: Assert that in each GlyphRanges[] pairs first is <= second.
|
||||
- ImDrawList: Added missing early-out in AddPolyline() and AddConvexPolyFilled() when
|
||||
color alpha is zero.
|
||||
- Misc: Most text functions treat "%s" as a shortcut to no-formatting. (#3466)
|
||||
@ -159,15 +164,15 @@ All changes:
|
||||
can exacerbate that. (#6114, #3644)
|
||||
- Backends: OSX: Fixed scroll/wheel scaling for devices emitting events with
|
||||
hasPreciseScrollingDeltas==false (e.g. non-Apple mices).
|
||||
- Backends: Win32: flipping WM_MOUSEHWHEEL value to match other backends and
|
||||
- Backends: Win32: flipping WM_MOUSEHWHEEL horizontal value to match other backends and
|
||||
offer consistent horizontal scrolling direction. (#4019)
|
||||
- Backends: SDL2: flipping SDL_MOUSEWHEEL 'wheel.x' value to match other backends and
|
||||
- Backends: SDL2: flipping SDL_MOUSEWHEEL horizontal value to match other backends and
|
||||
offer consistent horizontal scrolling direction. (#4019)
|
||||
- Backends: SDL2: Removed SDL_MOUSEWHEEL value clamping. (#4019, #6096, #6081)
|
||||
- Backends: SDL2: Added support for SDL 2.0.18+ preciseX/preciseY mouse wheel data
|
||||
for smooth scrolling as reported by SDL. (#4019, #6096)
|
||||
- Backends: SDL2: Avoid calling SDL_SetCursor() when cursor has not changed, as the function
|
||||
is surprisingly costly on Mac with latest SDL (may be fixed in next SDL version). (#6113)
|
||||
is surprisingly costly on Mac with latest SDL (already fixed in SDL latest trunk). (#6113)
|
||||
- Backends: SDL2: Implement IME handler to call SDL_SetTextInputRect()/SDL_StartTextInput().
|
||||
It will only works with SDL 2.0.18+ if your code calls 'SDL_SetHint(SDL_HINT_IME_SHOW_UI, "1")'
|
||||
prior to calling SDL_CreateWindow(). Updated all examples accordingly. (#6071, #1953)
|
||||
@ -180,7 +185,8 @@ All changes:
|
||||
- Backends: GLFW: Added ImGui_ImplGlfw_SetCallbacksChainForAllWindows() to instruct backend
|
||||
to chain callbacks even for secondary viewports/windows. User callbacks may need to test
|
||||
the 'window' parameter. (#6142)
|
||||
- Backends: WebGPU: Fix building for latest WebGPU specs (remove implicit layout generation).
|
||||
- Backends: OpenGL3: Fixed GL loader compatibility with 2.x profiles. (#6154, #4445, #3530) [@grauw]
|
||||
- Backends: WebGPU: Fixed building for latest WebGPU specs (remove implicit layout generation).
|
||||
(#6117, #4116, #3632) [@tonygrue, @bfierz]
|
||||
- Examples: refactored SDL2+GL and GLFW+GL examples to compile with Emscripten.
|
||||
(#2492, #2494, #3699, #3705) [@ocornut, @nicolasnoble]
|
||||
@ -189,7 +195,7 @@ All changes:
|
||||
- Examples: Win32: Fixed examples using RegisterClassW() since 1.89 to also call
|
||||
DefWindowProcW() instead of DefWindowProc() so that title text are correctly converted
|
||||
when application is compiled without /DUNICODE. (#5725, #5961, #5975) [@markreidvfx]
|
||||
- Examples: SDL2+SDL_Renderer: Added call to SDL_RenderSetScale() to display is correct on a
|
||||
- Examples: SDL2+SDL_Renderer: Added call to SDL_RenderSetScale() to fix display on a
|
||||
Retina display (albeit lower-res as our other unmodified examples). (#6121, #6065, #5931).
|
||||
|
||||
Docking+Viewports Branch:
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.89.3 WIP
|
||||
// dear imgui, v1.89.3
|
||||
// (main code and documentation)
|
||||
|
||||
// Help:
|
||||
|
8
imgui.h
8
imgui.h
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.89.3 WIP
|
||||
// dear imgui, v1.89.3
|
||||
// (headers)
|
||||
|
||||
// Help:
|
||||
@ -22,8 +22,8 @@
|
||||
|
||||
// Library Version
|
||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM > 12345')
|
||||
#define IMGUI_VERSION "1.89.3 WIP"
|
||||
#define IMGUI_VERSION_NUM 18928
|
||||
#define IMGUI_VERSION "1.89.3"
|
||||
#define IMGUI_VERSION_NUM 18930
|
||||
#define IMGUI_HAS_TABLE
|
||||
#define IMGUI_HAS_VIEWPORT // Viewport WIP branch
|
||||
#define IMGUI_HAS_DOCK // Docking WIP branch
|
||||
@ -2776,7 +2776,7 @@ struct ImFontConfig
|
||||
bool PixelSnapH; // false // Align every glyph to pixel boundary. Useful e.g. if you are merging a non-pixel aligned font with the default font. If enabled, you can set OversampleH/V to 1.
|
||||
ImVec2 GlyphExtraSpacing; // 0, 0 // Extra spacing (in pixels) between glyphs. Only X axis is supported for now.
|
||||
ImVec2 GlyphOffset; // 0, 0 // Offset all glyphs from this font input.
|
||||
const ImWchar* GlyphRanges; // NULL // Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE.
|
||||
const ImWchar* GlyphRanges; // NULL // THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE. Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list).
|
||||
float GlyphMinAdvanceX; // 0 // Minimum AdvanceX for glyphs, set Min to align font icons, set both Min/Max to enforce mono-space font
|
||||
float GlyphMaxAdvanceX; // FLT_MAX // Maximum AdvanceX for glyphs
|
||||
bool MergeMode; // false // Merge into previous ImFont, so you can combine multiple inputs font into one ImFont (e.g. ASCII font + icons + Japanese glyphs). You may want to use GlyphOffset.y when merge font of different heights.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.89.3 WIP
|
||||
// dear imgui, v1.89.3
|
||||
// (demo code)
|
||||
|
||||
// Help:
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.89.3 WIP
|
||||
// dear imgui, v1.89.3
|
||||
// (drawing and font code)
|
||||
|
||||
/*
|
||||
@ -2390,7 +2390,12 @@ static bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
|
||||
ImFontBuildDstData& dst_tmp = dst_tmp_array[src_tmp.DstIndex];
|
||||
src_tmp.SrcRanges = cfg.GlyphRanges ? cfg.GlyphRanges : atlas->GetGlyphRangesDefault();
|
||||
for (const ImWchar* src_range = src_tmp.SrcRanges; src_range[0] && src_range[1]; src_range += 2)
|
||||
{
|
||||
// Check for valid range. This may also help detect *some* dangling pointers, because a common
|
||||
// user error is to setup ImFontConfig::GlyphRanges with a pointer to data that isn't persistent.
|
||||
IM_ASSERT(src_range[0] <= src_range[1]);
|
||||
src_tmp.GlyphsHighest = ImMax(src_tmp.GlyphsHighest, (int)src_range[1]);
|
||||
}
|
||||
dst_tmp.SrcCount++;
|
||||
dst_tmp.GlyphsHighest = ImMax(dst_tmp.GlyphsHighest, src_tmp.GlyphsHighest);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.89.3 WIP
|
||||
// dear imgui, v1.89.3
|
||||
// (internal structures/api)
|
||||
|
||||
// You may use this file to debug, understand or extend Dear ImGui features but we don't provide any guarantee of forward compatibility.
|
||||
@ -2134,9 +2134,11 @@ struct ImGuiContext
|
||||
ImFont InputTextPasswordFont;
|
||||
ImGuiID TempInputId; // Temporary text input when CTRL+clicking on a slider, etc.
|
||||
ImGuiColorEditFlags ColorEditOptions; // Store user options for color edit widgets
|
||||
float ColorEditLastHue; // Backup of last Hue associated to LastColor, so we can restore Hue in lossy RGB<>HSV round trips
|
||||
float ColorEditLastSat; // Backup of last Saturation associated to LastColor, so we can restore Saturation in lossy RGB<>HSV round trips
|
||||
ImU32 ColorEditLastColor; // RGB value with alpha set to 0.
|
||||
ImGuiID ColorEditCurrentID; // Set temporarily while inside of the parent-most ColorEdit4/ColorPicker4 (because they call each others).
|
||||
ImGuiID ColorEditSavedID; // ID we are saving/restoring HS for
|
||||
float ColorEditSavedHue; // Backup of last Hue associated to LastColor, so we can restore Hue in lossy RGB<>HSV round trips
|
||||
float ColorEditSavedSat; // Backup of last Saturation associated to LastColor, so we can restore Saturation in lossy RGB<>HSV round trips
|
||||
ImU32 ColorEditSavedColor; // RGB value with alpha set to 0.
|
||||
ImVec4 ColorPickerRef; // Initial/reference color at the time of opening the color picker.
|
||||
ImGuiComboPreviewData ComboPreviewData;
|
||||
float SliderGrabClickOffset;
|
||||
@ -2335,8 +2337,9 @@ struct ImGuiContext
|
||||
|
||||
TempInputId = 0;
|
||||
ColorEditOptions = ImGuiColorEditFlags_DefaultOptions_;
|
||||
ColorEditLastHue = ColorEditLastSat = 0.0f;
|
||||
ColorEditLastColor = 0;
|
||||
ColorEditCurrentID = ColorEditSavedID = 0;
|
||||
ColorEditSavedHue = ColorEditSavedSat = 0.0f;
|
||||
ColorEditSavedColor = 0;
|
||||
SliderGrabClickOffset = 0.0f;
|
||||
SliderCurrentAccum = 0.0f;
|
||||
SliderCurrentAccumDirty = false;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.89.3 WIP
|
||||
// dear imgui, v1.89.3
|
||||
// (tables and columns code)
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.89.3 WIP
|
||||
// dear imgui, v1.89.3
|
||||
// (widgets code)
|
||||
|
||||
/*
|
||||
@ -4985,28 +4985,32 @@ bool ImGui::ColorEdit3(const char* label, float col[3], ImGuiColorEditFlags flag
|
||||
return ColorEdit4(label, col, flags | ImGuiColorEditFlags_NoAlpha);
|
||||
}
|
||||
|
||||
static void ColorEditRestoreH(const float* col, float* H)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(g.ColorEditCurrentID != 0);
|
||||
if (g.ColorEditSavedID != g.ColorEditCurrentID || g.ColorEditSavedColor != ImGui::ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 0)))
|
||||
return;
|
||||
*H = g.ColorEditSavedHue;
|
||||
}
|
||||
|
||||
// ColorEdit supports RGB and HSV inputs. In case of RGB input resulting color may have undefined hue and/or saturation.
|
||||
// Since widget displays both RGB and HSV values we must preserve hue and saturation to prevent these values resetting.
|
||||
static void ColorEditRestoreHS(const float* col, float* H, float* S, float* V)
|
||||
{
|
||||
// This check is optional. Suppose we have two color widgets side by side, both widgets display different colors, but both colors have hue and/or saturation undefined.
|
||||
// With color check: hue/saturation is preserved in one widget. Editing color in one widget would reset hue/saturation in another one.
|
||||
// Without color check: common hue/saturation would be displayed in all widgets that have hue/saturation undefined.
|
||||
// g.ColorEditLastColor is stored as ImU32 RGB value: this essentially gives us color equality check with reduced precision.
|
||||
// Tiny external color changes would not be detected and this check would still pass. This is OK, since we only restore hue/saturation _only_ if they are undefined,
|
||||
// therefore this change flipping hue/saturation from undefined to a very tiny value would still be represented in color picker.
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (g.ColorEditLastColor != ImGui::ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 0)))
|
||||
IM_ASSERT(g.ColorEditCurrentID != 0);
|
||||
if (g.ColorEditSavedID != g.ColorEditCurrentID || g.ColorEditSavedColor != ImGui::ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 0)))
|
||||
return;
|
||||
|
||||
// When S == 0, H is undefined.
|
||||
// When H == 1 it wraps around to 0.
|
||||
if (*S == 0.0f || (*H == 0.0f && g.ColorEditLastHue == 1))
|
||||
*H = g.ColorEditLastHue;
|
||||
if (*S == 0.0f || (*H == 0.0f && g.ColorEditSavedHue == 1))
|
||||
*H = g.ColorEditSavedHue;
|
||||
|
||||
// When V == 0, S is undefined.
|
||||
if (*V == 0.0f)
|
||||
*S = g.ColorEditLastSat;
|
||||
*S = g.ColorEditSavedSat;
|
||||
}
|
||||
|
||||
// Edit colors components (each component in 0.0f..1.0f range).
|
||||
@ -5029,6 +5033,9 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
||||
|
||||
BeginGroup();
|
||||
PushID(label);
|
||||
const bool set_current_color_edit_id = (g.ColorEditCurrentID == 0);
|
||||
if (set_current_color_edit_id)
|
||||
g.ColorEditCurrentID = window->IDStack.back();
|
||||
|
||||
// If we're not showing any slider there's no point in doing any HSV conversions
|
||||
const ImGuiColorEditFlags flags_untouched = flags;
|
||||
@ -5062,7 +5069,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
||||
ColorConvertHSVtoRGB(f[0], f[1], f[2], f[0], f[1], f[2]);
|
||||
else if ((flags & ImGuiColorEditFlags_InputRGB) && (flags & ImGuiColorEditFlags_DisplayHSV))
|
||||
{
|
||||
// Hue is lost when converting from greyscale rgb (saturation=0). Restore it.
|
||||
// Hue is lost when converting from grayscale rgb (saturation=0). Restore it.
|
||||
ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]);
|
||||
ColorEditRestoreHS(col, &f[0], &f[1], &f[2]);
|
||||
}
|
||||
@ -5201,10 +5208,11 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
||||
f[n] = i[n] / 255.0f;
|
||||
if ((flags & ImGuiColorEditFlags_DisplayHSV) && (flags & ImGuiColorEditFlags_InputRGB))
|
||||
{
|
||||
g.ColorEditLastHue = f[0];
|
||||
g.ColorEditLastSat = f[1];
|
||||
g.ColorEditSavedHue = f[0];
|
||||
g.ColorEditSavedSat = f[1];
|
||||
ColorConvertHSVtoRGB(f[0], f[1], f[2], f[0], f[1], f[2]);
|
||||
g.ColorEditLastColor = ColorConvertFloat4ToU32(ImVec4(f[0], f[1], f[2], 0));
|
||||
g.ColorEditSavedID = g.ColorEditCurrentID;
|
||||
g.ColorEditSavedColor = ColorConvertFloat4ToU32(ImVec4(f[0], f[1], f[2], 0));
|
||||
}
|
||||
if ((flags & ImGuiColorEditFlags_DisplayRGB) && (flags & ImGuiColorEditFlags_InputHSV))
|
||||
ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]);
|
||||
@ -5216,6 +5224,8 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
||||
col[3] = f[3];
|
||||
}
|
||||
|
||||
if (set_current_color_edit_id)
|
||||
g.ColorEditCurrentID = 0;
|
||||
PopID();
|
||||
EndGroup();
|
||||
|
||||
@ -5289,6 +5299,9 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
||||
g.NextItemData.ClearFlags();
|
||||
|
||||
PushID(label);
|
||||
const bool set_current_color_edit_id = (g.ColorEditCurrentID == 0);
|
||||
if (set_current_color_edit_id)
|
||||
g.ColorEditCurrentID = window->IDStack.back();
|
||||
BeginGroup();
|
||||
|
||||
if (!(flags & ImGuiColorEditFlags_NoSidePreview))
|
||||
@ -5337,7 +5350,7 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
||||
float R = col[0], G = col[1], B = col[2];
|
||||
if (flags & ImGuiColorEditFlags_InputRGB)
|
||||
{
|
||||
// Hue is lost when converting from greyscale rgb (saturation=0). Restore it.
|
||||
// Hue is lost when converting from grayscale rgb (saturation=0). Restore it.
|
||||
ColorConvertRGBtoHSV(R, G, B, H, S, V);
|
||||
ColorEditRestoreHS(col, &H, &S, &V);
|
||||
}
|
||||
@ -5392,10 +5405,7 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
||||
{
|
||||
S = ImSaturate((io.MousePos.x - picker_pos.x) / (sv_picker_size - 1));
|
||||
V = 1.0f - ImSaturate((io.MousePos.y - picker_pos.y) / (sv_picker_size - 1));
|
||||
|
||||
// Greatly reduces hue jitter and reset to 0 when hue == 255 and color is rapidly modified using SV square.
|
||||
if (g.ColorEditLastColor == ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 0)))
|
||||
H = g.ColorEditLastHue;
|
||||
ColorEditRestoreH(col, &H); // Greatly reduces hue jitter and reset to 0 when hue == 255 and color is rapidly modified using SV square.
|
||||
value_changed = value_changed_sv = true;
|
||||
}
|
||||
if (!(flags & ImGuiColorEditFlags_NoOptions))
|
||||
@ -5470,9 +5480,10 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
||||
if (flags & ImGuiColorEditFlags_InputRGB)
|
||||
{
|
||||
ColorConvertHSVtoRGB(H, S, V, col[0], col[1], col[2]);
|
||||
g.ColorEditLastHue = H;
|
||||
g.ColorEditLastSat = S;
|
||||
g.ColorEditLastColor = ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 0));
|
||||
g.ColorEditSavedHue = H;
|
||||
g.ColorEditSavedSat = S;
|
||||
g.ColorEditSavedID = g.ColorEditCurrentID;
|
||||
g.ColorEditSavedColor = ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 0));
|
||||
}
|
||||
else if (flags & ImGuiColorEditFlags_InputHSV)
|
||||
{
|
||||
@ -5636,6 +5647,8 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
||||
if (value_changed && g.LastItemData.ID != 0) // In case of ID collision, the second EndGroup() won't catch g.ActiveId
|
||||
MarkItemEdited(g.LastItemData.ID);
|
||||
|
||||
if (set_current_color_edit_id)
|
||||
g.ColorEditCurrentID = 0;
|
||||
PopID();
|
||||
|
||||
return value_changed;
|
||||
|
@ -444,7 +444,12 @@ bool ImFontAtlasBuildWithFreeTypeEx(FT_Library ft_library, ImFontAtlas* atlas, u
|
||||
ImFontBuildDstDataFT& dst_tmp = dst_tmp_array[src_tmp.DstIndex];
|
||||
src_tmp.SrcRanges = cfg.GlyphRanges ? cfg.GlyphRanges : atlas->GetGlyphRangesDefault();
|
||||
for (const ImWchar* src_range = src_tmp.SrcRanges; src_range[0] && src_range[1]; src_range += 2)
|
||||
{
|
||||
// Check for valid range. This may also help detect *some* dangling pointers, because a common
|
||||
// user error is to setup ImFontConfig::GlyphRanges with a pointer to data that isn't persistent.
|
||||
IM_ASSERT(src_range[0] <= src_range[1]);
|
||||
src_tmp.GlyphsHighest = ImMax(src_tmp.GlyphsHighest, (int)src_range[1]);
|
||||
}
|
||||
dst_tmp.SrcCount++;
|
||||
dst_tmp.GlyphsHighest = ImMax(dst_tmp.GlyphsHighest, src_tmp.GlyphsHighest);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user