(Breaking) DrawList: removed half pixel offset from ImDrawList::AddLine()

- removed half pixel offset from ImDrawList::AddLine()
- added ImDrawList::AddHorizontalLine() and ImDrawList::AddVerticalLine() which draw line to the side of the specified line
- Change uses of AddLine() which were obviously vertical and horizontal  to use the v and h lines
- Fixed layouting issues from above changes
- Changed primitives demo to use vline and hline
- Fixed angled header to match original
- Fixed separator line to match original
- Fixed caret to match original
- Fix separator vertical alignment
- Added stroke pos, which controls how stroke is draw relative to the shape
- Kept legacy mode which does 1/2px inset
- Added stroke pos support for Rect, Circle, Ngon, and Ellipse
- add stroke pos to hline and vline
- Added drawflag ImDrawFlags_TruncateCoords which allows to hint the renderer that the input is snapped to pixels (can disable AA in some cases)
- Implemented 9-slice renderer for rounded corners
- Remove ImDrawFlags_TruncateCoords flag in favor of detecting truncated coords.
- Renamed to AddLineH(), AddLineV()
- Removed ImDrawStrokePos, folded into ImDrawFlags
This commit is contained in:
Mikko Mononen
2026-04-28 00:04:59 +02:00
committed by ocornut
parent 94c05ba40b
commit 76184b6308
3 changed files with 99 additions and 14 deletions

View File

@@ -1389,6 +1389,9 @@ static const float DOCKING_TRANSPARENT_PAYLOAD_ALPHA = 0.50f; // For u
// [SECTION] FORWARD DECLARATIONS
//-------------------------------------------------------------------------
extern bool g_LEGACY_STROKES;
bool g_LEGACY_STROKES = false;
static void SetCurrentWindow(ImGuiWindow* window);
static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags);
static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window);
@@ -6088,6 +6091,9 @@ void ImGui::NewFrame()
g.DebugBeginReturnValueCullDepth = -1;
#endif
g_LEGACY_STROKES = g.IO.KeyShift;
ImGui::Checkbox("g_LEGACY_STROKES", &g_LEGACY_STROKES);
CallContextHooks(&g, ImGuiContextHookType_NewFramePost);
}