mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Internal: Moved NavScrollToBringItemIntoView() declaration to imgui_internal.h. Fixed spacing missing in 494d804
. Fixed changelog wreck from 1.72.
This commit is contained in:
parent
5ef7445d92
commit
1b1e539288
@ -50,7 +50,6 @@ Breaking Changes:
|
||||
Kept redirection function (will obsolete). (#581, #324)
|
||||
|
||||
Other Changes:
|
||||
comments about the right way to scale your UI (load a font at the right side, rebuild atlas, scale style).
|
||||
- Scrolling: Made mouse-wheel scrolling lock the underlying window until the mouse is moved again or
|
||||
until a short delay expires (~2 seconds). This allow uninterrupted scroll even if child windows are
|
||||
passing under the mouse cursor. (#2604)
|
||||
@ -67,6 +66,7 @@ Other Changes:
|
||||
any more. Forwarding can still be disabled by setting ImGuiWindowFlags_NoInputs. (amend #1502, #1380).
|
||||
- Window: Fixed InnerClipRect right-most coordinates using wrong padding setting (introduced in 1.71).
|
||||
- Window: Fixed old SetWindowFontScale() api value from not being inherited by child window. Added
|
||||
comments about the right way to scale your UI (load a font at the right side, rebuild atlas, scale style).
|
||||
- Scrollbar: Avoid overlapping the opposite side when window (often a child window) is forcibly too small.
|
||||
- Combo: Hide arrow when there's not enough space even for the square button.
|
||||
- InputText: Testing for newly added ImGuiKey_KeyPadEnter key. (#2677, #2005) [@amc522]
|
||||
|
@ -8139,8 +8139,7 @@ ImVec2 ImGui::GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInput
|
||||
}
|
||||
|
||||
// Scroll to keep newly navigated item fully into view
|
||||
// NB: We modify rect_rel by the amount we scrolled for, so it is immediately updated.
|
||||
static void NavScrollToBringItemIntoView(ImGuiWindow* window, const ImRect& item_rect)
|
||||
void ImGui::NavScrollToBringItemIntoView(ImGuiWindow* window, const ImRect& item_rect)
|
||||
{
|
||||
ImRect window_rect(window->InnerRect.Min - ImVec2(1, 1), window->InnerRect.Max + ImVec2(1, 1));
|
||||
//GetForegroundDrawList(window)->AddRect(window_rect.Min, window_rect.Max, IM_COL32_WHITE); // [DEBUG]
|
||||
|
@ -2064,23 +2064,23 @@ static void ShowDemoWindowLayout()
|
||||
// Vertical scroll functions
|
||||
HelpMarker("Use SetScrollHereY() or SetScrollFromPosY() to scroll to a given vertical position.");
|
||||
|
||||
static bool track = true;
|
||||
static int track_item = 50;
|
||||
static bool enable_track = true;
|
||||
static float scroll_to_off_px = 0.0f;
|
||||
static float scroll_to_pos_px = 200.0f;
|
||||
ImGui::Checkbox("Track", &track);
|
||||
ImGui::Checkbox("Track", &enable_track);
|
||||
ImGui::PushItemWidth(100);
|
||||
ImGui::SameLine(140); track |= ImGui::DragInt("##item", &track_item, 0.25f, 0, 99, "Item = %d");
|
||||
ImGui::SameLine(140); enable_track |= ImGui::DragInt("##item", &track_item, 0.25f, 0, 99, "Item = %d");
|
||||
|
||||
bool scroll_to_off = ImGui::Button("Scroll Offset");
|
||||
ImGui::SameLine(140); scroll_to_off |= ImGui::DragFloat("##off", &scroll_to_off_px, 1.00f, 0, 9999, "+%.0f px");
|
||||
|
||||
bool scroll_to_pos = ImGui::Button("Scroll To Pos");
|
||||
ImGui::SameLine(140); scroll_to_pos |= ImGui::DragFloat("##pos", &scroll_to_pos_px, 1.00f, 0, 9999, "X/Y = %.0f px");
|
||||
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
if (scroll_to_off || scroll_to_pos)
|
||||
track = false;
|
||||
enable_track = false;
|
||||
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
float child_w = (ImGui::GetContentRegionAvail().x - 4 * style.ItemSpacing.x) / 5;
|
||||
@ -2101,7 +2101,7 @@ static void ShowDemoWindowLayout()
|
||||
ImGui::SetScrollFromPosY(ImGui::GetCursorStartPos().y + scroll_to_pos_px, i * 0.25f);
|
||||
for (int item = 0; item < 100; item++)
|
||||
{
|
||||
if (track && item == track_item)
|
||||
if (enable_track && item == track_item)
|
||||
{
|
||||
ImGui::TextColored(ImVec4(1,1,0,1), "Item %d", item);
|
||||
ImGui::SetScrollHereY(i * 0.25f); // 0.0f:top, 0.5f:center, 1.0f:bottom
|
||||
@ -2133,7 +2133,7 @@ static void ShowDemoWindowLayout()
|
||||
ImGui::SetScrollFromPosX(ImGui::GetCursorStartPos().x + scroll_to_pos_px, i * 0.25f);
|
||||
for (int item = 0; item < 100; item++)
|
||||
{
|
||||
if (track && item == track_item)
|
||||
if (enable_track && item == track_item)
|
||||
{
|
||||
ImGui::TextColored(ImVec4(1, 1, 0, 1), "Item %d", item);
|
||||
ImGui::SetScrollHereX(i * 0.25f); // 0.0f:left, 0.5f:center, 1.0f:right
|
||||
|
@ -634,19 +634,19 @@ struct IMGUI_API ImGuiInputTextState
|
||||
ImGuiInputTextCallback UserCallback; // "
|
||||
void* UserCallbackData; // "
|
||||
|
||||
ImGuiInputTextState() { memset(this, 0, sizeof(*this)); }
|
||||
ImGuiInputTextState() { memset(this, 0, sizeof(*this)); }
|
||||
void ClearText() { CurLenW = CurLenA = 0; TextW[0] = 0; TextA[0] = 0; CursorClamp(); }
|
||||
void ClearFreeMemory() { TextW.clear(); TextA.clear(); InitialTextA.clear(); }
|
||||
void ClearFreeMemory() { TextW.clear(); TextA.clear(); InitialTextA.clear(); }
|
||||
int GetUndoAvailCount() const { return Stb.undostate.undo_point; }
|
||||
int GetRedoAvailCount() const { return STB_TEXTEDIT_UNDOSTATECOUNT - Stb.undostate.redo_point; }
|
||||
void OnKeyPressed(int key); // Cannot be inline because we call in code in stb_textedit.h implementation
|
||||
|
||||
// Cursor & Selection
|
||||
void CursorAnimReset() { CursorAnim = -0.30f; } // After a user-input the cursor stays on for a while without blinking
|
||||
void CursorClamp() { Stb.cursor = ImMin(Stb.cursor, CurLenW); Stb.select_start = ImMin(Stb.select_start, CurLenW); Stb.select_end = ImMin(Stb.select_end, CurLenW); }
|
||||
bool HasSelection() const { return Stb.select_start != Stb.select_end; }
|
||||
void ClearSelection() { Stb.select_start = Stb.select_end = Stb.cursor; }
|
||||
void SelectAll() { Stb.select_start = 0; Stb.cursor = Stb.select_end = CurLenW; Stb.has_preferred_x = 0; }
|
||||
void CursorAnimReset() { CursorAnim = -0.30f; } // After a user-input the cursor stays on for a while without blinking
|
||||
void CursorClamp() { Stb.cursor = ImMin(Stb.cursor, CurLenW); Stb.select_start = ImMin(Stb.select_start, CurLenW); Stb.select_end = ImMin(Stb.select_end, CurLenW); }
|
||||
bool HasSelection() const { return Stb.select_start != Stb.select_end; }
|
||||
void ClearSelection() { Stb.select_start = Stb.select_end = Stb.cursor; }
|
||||
void SelectAll() { Stb.select_start = 0; Stb.cursor = Stb.select_end = CurLenW; Stb.has_preferred_x = 0; }
|
||||
};
|
||||
|
||||
// Windows data saved in imgui.ini file
|
||||
@ -1549,6 +1549,7 @@ namespace ImGui
|
||||
IMGUI_API void NavMoveRequestCancel();
|
||||
IMGUI_API void NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir clip_dir, const ImRect& bb_rel, ImGuiNavMoveFlags move_flags);
|
||||
IMGUI_API void NavMoveRequestTryWrapping(ImGuiWindow* window, ImGuiNavMoveFlags move_flags);
|
||||
IMGUI_API void NavScrollToBringItemIntoView(ImGuiWindow* window, const ImRect& item_rect);
|
||||
IMGUI_API float GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMode mode);
|
||||
IMGUI_API ImVec2 GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor = 0.0f, float fast_factor = 0.0f);
|
||||
IMGUI_API int CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate);
|
||||
|
Loading…
Reference in New Issue
Block a user