mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-23 12:27:01 +00:00
SetScrollPosHere() takes account of item height + more accurate centering
This commit is contained in:
parent
e8422f7aa0
commit
3ca54ad369
@ -3717,7 +3717,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|||||||
// Apply scrolling
|
// Apply scrolling
|
||||||
if (window->ScrollTargetCenterY >= 0.0f)
|
if (window->ScrollTargetCenterY >= 0.0f)
|
||||||
{
|
{
|
||||||
window->ScrollY = window->ScrollTargetCenterY - (window->Pos.y + window->SizeFull.y * 0.5f) - (window->TitleBarHeight() + window->WindowPadding().y);
|
window->ScrollY = window->ScrollTargetCenterY - (window->Pos.y + (window->SizeFull.y + window->TitleBarHeight() + window->WindowPadding().y) * 0.5f);
|
||||||
window->ScrollTargetCenterY = -1.0f;
|
window->ScrollTargetCenterY = -1.0f;
|
||||||
}
|
}
|
||||||
window->ScrollY = ImMax(window->ScrollY, 0.0f);
|
window->ScrollY = ImMax(window->ScrollY, 0.0f);
|
||||||
@ -4646,7 +4646,7 @@ float ImGui::GetScrollMaxY()
|
|||||||
void ImGui::SetScrollPosHere()
|
void ImGui::SetScrollPosHere()
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
window->ScrollTargetCenterY = (window->DC.CursorPos.y + window->ScrollY);
|
window->ScrollTargetCenterY = (window->DC.CursorPos.y + window->ScrollY) - window->DC.PrevLineHeight * 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::SetKeyboardFocusHere(int offset)
|
void ImGui::SetKeyboardFocusHere(int offset)
|
||||||
|
Loading…
Reference in New Issue
Block a user