mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-25 21:17:01 +00:00
Begin: moved tooltip position code in an else block. Misc comments
This commit is contained in:
parent
52cac135c9
commit
928a4ad315
11
imgui.cpp
11
imgui.cpp
@ -5476,9 +5476,9 @@ static void CalcResizePosSizeFromAnyCorner(ImGuiWindow* window, const ImVec2& co
|
|||||||
|
|
||||||
struct ImGuiResizeGripDef
|
struct ImGuiResizeGripDef
|
||||||
{
|
{
|
||||||
ImVec2 CornerPos;
|
ImVec2 CornerPos;
|
||||||
ImVec2 InnerDir;
|
ImVec2 InnerDir;
|
||||||
int AngleMin12, AngleMax12;
|
int AngleMin12, AngleMax12;
|
||||||
};
|
};
|
||||||
|
|
||||||
const ImGuiResizeGripDef resize_grip_def[4] =
|
const ImGuiResizeGripDef resize_grip_def[4] =
|
||||||
@ -5890,10 +5890,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
ImRect rect_to_avoid(window->PosFloat.x - 1, window->PosFloat.y - 1, window->PosFloat.x + 1, window->PosFloat.y + 1);
|
ImRect rect_to_avoid(window->PosFloat.x - 1, window->PosFloat.y - 1, window->PosFloat.x + 1, window->PosFloat.y + 1);
|
||||||
window->PosFloat = FindBestWindowPosForPopup(window->PosFloat, window->Size, &window->AutoPosLastDirection, rect_to_avoid);
|
window->PosFloat = FindBestWindowPosForPopup(window->PosFloat, window->Size, &window->AutoPosLastDirection, rect_to_avoid);
|
||||||
}
|
}
|
||||||
|
else if ((flags & ImGuiWindowFlags_Tooltip) != 0 && !window_pos_set_by_api && !window_is_child_tooltip)
|
||||||
// Position tooltip (always follows mouse)
|
|
||||||
if ((flags & ImGuiWindowFlags_Tooltip) != 0 && !window_pos_set_by_api && !window_is_child_tooltip)
|
|
||||||
{
|
{
|
||||||
|
// Position tooltip (always follow mouse but avoid cursor)
|
||||||
float sc = g.Style.MouseCursorScale;
|
float sc = g.Style.MouseCursorScale;
|
||||||
ImVec2 ref_pos = (!g.NavDisableHighlight && g.NavDisableMouseHover) ? NavCalcPreferredMousePos() : g.IO.MousePos;
|
ImVec2 ref_pos = (!g.NavDisableHighlight && g.NavDisableMouseHover) ? NavCalcPreferredMousePos() : g.IO.MousePos;
|
||||||
ImRect rect_to_avoid;
|
ImRect rect_to_avoid;
|
||||||
|
@ -1733,7 +1733,7 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
|
|||||||
IM_ASSERT(cfg.DstFont && (!cfg.DstFont->IsLoaded() || cfg.DstFont->ContainerAtlas == atlas));
|
IM_ASSERT(cfg.DstFont && (!cfg.DstFont->IsLoaded() || cfg.DstFont->ContainerAtlas == atlas));
|
||||||
|
|
||||||
const int font_offset = stbtt_GetFontOffsetForIndex((unsigned char*)cfg.FontData, cfg.FontNo);
|
const int font_offset = stbtt_GetFontOffsetForIndex((unsigned char*)cfg.FontData, cfg.FontNo);
|
||||||
IM_ASSERT(font_offset >= 0);
|
IM_ASSERT(font_offset >= 0 && "FontData is incorrect, or FontNo cannot be found.");
|
||||||
if (!stbtt_InitFont(&tmp.FontInfo, (unsigned char*)cfg.FontData, font_offset))
|
if (!stbtt_InitFont(&tmp.FontInfo, (unsigned char*)cfg.FontData, font_offset))
|
||||||
{
|
{
|
||||||
atlas->TexWidth = atlas->TexHeight = 0; // Reset output on failure
|
atlas->TexWidth = atlas->TexHeight = 0; // Reset output on failure
|
||||||
|
Loading…
Reference in New Issue
Block a user