@@ -1111,8 +1111,22 @@ ed::EditorContext::~EditorContext()
11111111
11121112void ed::EditorContext::Begin (const char * id, const ImVec2& size)
11131113{
1114+ m_EditorActiveId = ImGui::GetID (id);
1115+ ImGui::PushID (id);
1116+
1117+ auto availableContentSize = ImGui::GetContentRegionAvail ();
1118+ ImVec2 canvasSize = ImFloor (size);
1119+ if (canvasSize.x <= 0 .0f )
1120+ canvasSize.x = ImMax (4 .0f , availableContentSize.x );
1121+ if (canvasSize.y <= 0 .0f )
1122+ canvasSize.y = ImMax (4 .0f , availableContentSize.y );
1123+
11141124 if (!m_IsInitialized)
11151125 {
1126+ // Cycle canvas so it has a change to setup its size before settings are loaded
1127+ m_Canvas.Begin (id, canvasSize);
1128+ m_Canvas.End ();
1129+
11161130 LoadSettings ();
11171131 m_IsInitialized = true ;
11181132 }
@@ -1146,16 +1160,6 @@ void ed::EditorContext::Begin(const char* id, const ImVec2& size)
11461160 ImDrawList_SwapSplitter (m_DrawList, m_Splitter);
11471161 m_ExternalChannel = m_DrawList->_Splitter ._Current ;
11481162
1149- m_EditorActiveId = ImGui::GetID (id);
1150- ImGui::PushID (id);
1151-
1152- auto availableContentSize = ImGui::GetContentRegionAvail ();
1153- ImVec2 canvasSize = ImFloor (size);
1154- if (canvasSize.x <= 0 .0f )
1155- canvasSize.x = ImMax (4 .0f , availableContentSize.x );
1156- if (canvasSize.y <= 0 .0f )
1157- canvasSize.y = ImMax (4 .0f , availableContentSize.y );
1158-
11591163 if (m_CurrentAction && m_CurrentAction->IsDragging () && m_NavigateAction.MoveOverEdge (canvasSize))
11601164 {
11611165 auto & io = ImGui::GetIO ();
0 commit comments