mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-25 17:16:35 +00:00
Removed CalcItemRectClosestPoint() which was weird and not really used by anyone except demo code. If you need it it's easy to replicate on your side.
Removed internal corresponding ImRect::GetClosestPoint() for now.
Essentially revert dcaafffe0e
.
This commit is contained in:
parent
9f8632b131
commit
2dd2ca0096
@ -213,6 +213,7 @@
|
|||||||
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
|
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
|
||||||
Also read releases logs https://github.com/ocornut/imgui/releases for more details.
|
Also read releases logs https://github.com/ocornut/imgui/releases for more details.
|
||||||
|
|
||||||
|
- 2017/12/29 (1.54) - removed CalcItemRectClosestPoint() which was weird and not really used by anyone except demo code. If you need it it's easy to replicate on your side.
|
||||||
- 2017/12/24 (1.53) - renamed the emblematic ShowTestWindow() function to ShowDemoWindow(). Kept redirection function (will obsolete).
|
- 2017/12/24 (1.53) - renamed the emblematic ShowTestWindow() function to ShowDemoWindow(). Kept redirection function (will obsolete).
|
||||||
- 2017/12/21 (1.53) - ImDrawList: renamed style.AntiAliasedShapes to style.AntiAliasedFill for consistency and as a way to explicitly break code that manipulate those flag at runtime. You can now manipulate ImDrawList::Flags
|
- 2017/12/21 (1.53) - ImDrawList: renamed style.AntiAliasedShapes to style.AntiAliasedFill for consistency and as a way to explicitly break code that manipulate those flag at runtime. You can now manipulate ImDrawList::Flags
|
||||||
- 2017/12/21 (1.53) - ImDrawList: removed 'bool anti_aliased = true' final parameter of ImDrawList::AddPolyline() and ImDrawList::AddConvexPolyFilled(). Prefer manipulating ImDrawList::Flags if you need to toggle them during the frame.
|
- 2017/12/21 (1.53) - ImDrawList: removed 'bool anti_aliased = true' final parameter of ImDrawList::AddPolyline() and ImDrawList::AddConvexPolyFilled(). Prefer manipulating ImDrawList::Flags if you need to toggle them during the frame.
|
||||||
@ -3658,14 +3659,6 @@ ImVec2 ImGui::GetItemRectSize()
|
|||||||
return window->DC.LastItemRect.GetSize();
|
return window->DC.LastItemRect.GetSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImVec2 ImGui::CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge, float outward)
|
|
||||||
{
|
|
||||||
ImGuiWindow* window = GetCurrentWindowRead();
|
|
||||||
ImRect rect = window->DC.LastItemRect;
|
|
||||||
rect.Expand(outward);
|
|
||||||
return rect.GetClosestPoint(pos, on_edge);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ImRect GetVisibleRect()
|
static ImRect GetVisibleRect()
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
2
imgui.h
2
imgui.h
@ -472,7 +472,6 @@ namespace ImGui
|
|||||||
IMGUI_API ImDrawList* GetOverlayDrawList(); // this draw list will be the last rendered one, useful to quickly draw overlays shapes/text
|
IMGUI_API ImDrawList* GetOverlayDrawList(); // this draw list will be the last rendered one, useful to quickly draw overlays shapes/text
|
||||||
IMGUI_API ImDrawListSharedData* GetDrawListSharedData();
|
IMGUI_API ImDrawListSharedData* GetDrawListSharedData();
|
||||||
IMGUI_API const char* GetStyleColorName(ImGuiCol idx);
|
IMGUI_API const char* GetStyleColorName(ImGuiCol idx);
|
||||||
IMGUI_API ImVec2 CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge = false, float outward = +0.0f); // utility to find the closest point the last item bounding rectangle edge. useful to visually link items
|
|
||||||
IMGUI_API ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
|
IMGUI_API ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
|
||||||
IMGUI_API void CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end); // calculate coarse clipping for large list of evenly sized items. Prefer using the ImGuiListClipper higher-level helper if you can.
|
IMGUI_API void CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end); // calculate coarse clipping for large list of evenly sized items. Prefer using the ImGuiListClipper higher-level helper if you can.
|
||||||
|
|
||||||
@ -987,6 +986,7 @@ struct ImGuiIO
|
|||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
namespace ImGui
|
namespace ImGui
|
||||||
{
|
{
|
||||||
|
static inline ImVec2 CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge = false, float outward = +0.0f) { (void)on_edge; (void)outward; return pos; } // OBSOLETE 1.54+
|
||||||
static inline void ShowTestWindow() { return ShowDemoWindow(); } // OBSOLETE 1.53+
|
static inline void ShowTestWindow() { return ShowDemoWindow(); } // OBSOLETE 1.53+
|
||||||
static inline bool IsRootWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootWindow); } // OBSOLETE 1.53+
|
static inline bool IsRootWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootWindow); } // OBSOLETE 1.53+
|
||||||
static inline bool IsRootWindowOrAnyChildFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows); } // OBSOLETE 1.53+
|
static inline bool IsRootWindowOrAnyChildFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows); } // OBSOLETE 1.53+
|
||||||
|
@ -1894,7 +1894,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
// Draw a line between the button and the mouse cursor
|
// Draw a line between the button and the mouse cursor
|
||||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||||
draw_list->PushClipRectFullScreen();
|
draw_list->PushClipRectFullScreen();
|
||||||
draw_list->AddLine(ImGui::CalcItemRectClosestPoint(io.MousePos, true, -2.0f), io.MousePos, ImColor(ImGui::GetStyle().Colors[ImGuiCol_Button]), 4.0f);
|
draw_list->AddLine(io.MouseClickedPos[0], io.MousePos, ImGui::GetColorU32(ImGuiCol_Button), 4.0f);
|
||||||
draw_list->PopClipRect();
|
draw_list->PopClipRect();
|
||||||
|
|
||||||
// Drag operations gets "unlocked" when the mouse has moved past a certain threshold (the default threshold is stored in io.MouseDragThreshold)
|
// Drag operations gets "unlocked" when the mouse has moved past a certain threshold (the default threshold is stored in io.MouseDragThreshold)
|
||||||
|
@ -290,16 +290,6 @@ struct IMGUI_API ImRect
|
|||||||
void Floor() { Min.x = (float)(int)Min.x; Min.y = (float)(int)Min.y; Max.x = (float)(int)Max.x; Max.y = (float)(int)Max.y; }
|
void Floor() { Min.x = (float)(int)Min.x; Min.y = (float)(int)Min.y; Max.x = (float)(int)Max.x; Max.y = (float)(int)Max.y; }
|
||||||
void FixInverted() { if (Min.x > Max.x) ImSwap(Min.x, Max.x); if (Min.y > Max.y) ImSwap(Min.y, Max.y); }
|
void FixInverted() { if (Min.x > Max.x) ImSwap(Min.x, Max.x); if (Min.y > Max.y) ImSwap(Min.y, Max.y); }
|
||||||
bool IsFinite() const { return Min.x != FLT_MAX; }
|
bool IsFinite() const { return Min.x != FLT_MAX; }
|
||||||
ImVec2 GetClosestPoint(ImVec2 p, bool on_edge) const
|
|
||||||
{
|
|
||||||
if (!on_edge && Contains(p))
|
|
||||||
return p;
|
|
||||||
if (p.x > Max.x) p.x = Max.x;
|
|
||||||
else if (p.x < Min.x) p.x = Min.x;
|
|
||||||
if (p.y > Max.y) p.y = Max.y;
|
|
||||||
else if (p.y < Min.y) p.y = Min.y;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Stacked color modifier, backup of modified data so we can restore it
|
// Stacked color modifier, backup of modified data so we can restore it
|
||||||
|
Loading…
Reference in New Issue
Block a user