File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ v0.9.2 (WIP):
41
41
42
42
BUGFIX: Editor: Clean long to int implicit cast warning in crude_json
43
43
44
+ BUGFIX: Canvas: Ensure canvas draw commands are separated from other ImGui draw commands (#205, #250)
45
+
44
46
45
47
v0.9.1 (2022-08-27):
46
48
Original file line number Diff line number Diff line change @@ -68,6 +68,12 @@ struct VtxCurrentOffsetRef
68
68
}
69
69
};
70
70
71
+ static void SentinelDrawCallback (const ImDrawList* parent_list, const ImDrawCmd* cmd)
72
+ {
73
+ // This is a sentinel draw callback, it's only purpose is to mark draw list command.
74
+ IM_ASSERT (false && " This draw callback should never be called." );
75
+ }
76
+
71
77
} // namespace ImCanvasDetails
72
78
73
79
// Returns a reference to _FringeScale extension to ImDrawList
@@ -429,7 +435,7 @@ void ImGuiEx::Canvas::EnterLocalSpace()
429
435
//
430
436
// More investigation is needed. To get to the bottom of this.
431
437
if ((!m_DrawList->CmdBuffer .empty () && m_DrawList->CmdBuffer .back ().ElemCount > 0 ) || m_DrawList->_Splitter ._Count > 1 )
432
- m_DrawList->AddDrawCmd ( );
438
+ m_DrawList->AddCallback (&ImCanvasDetails::SentinelDrawCallback, nullptr );
433
439
434
440
# if IMGUI_EX_CANVAS_DEFERED()
435
441
m_Ranges.resize (m_Ranges.Size + 1 );
@@ -547,6 +553,10 @@ void ImGuiEx::Canvas::LeaveLocalSpace()
547
553
}
548
554
}
549
555
556
+ // Remove sentinel draw command if present
557
+ if (m_DrawListCommadBufferSize > 0 && m_DrawList->CmdBuffer .size () >= m_DrawListCommadBufferSize && m_DrawList->CmdBuffer [m_DrawListCommadBufferSize - 1 ].UserCallback == &ImCanvasDetails::SentinelDrawCallback)
558
+ m_DrawList->CmdBuffer .erase (m_DrawList->CmdBuffer .Data + m_DrawListCommadBufferSize - 1 );
559
+
550
560
auto & fringeScale = ImFringeScaleRef (m_DrawList);
551
561
fringeScale = m_LastFringeScale;
552
562
You can’t perform that action at this time.
0 commit comments