@@ -1111,8 +1111,22 @@ ed::EditorContext::~EditorContext()
1111
1111
1112
1112
void ed::EditorContext::Begin (const char * id, const ImVec2& size)
1113
1113
{
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
+
1114
1124
if (!m_IsInitialized)
1115
1125
{
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
+
1116
1130
LoadSettings ();
1117
1131
m_IsInitialized = true ;
1118
1132
}
@@ -1146,16 +1160,6 @@ void ed::EditorContext::Begin(const char* id, const ImVec2& size)
1146
1160
ImDrawList_SwapSplitter (m_DrawList, m_Splitter);
1147
1161
m_ExternalChannel = m_DrawList->_Splitter ._Current ;
1148
1162
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
-
1159
1163
if (m_CurrentAction && m_CurrentAction->IsDragging () && m_NavigateAction.MoveOverEdge (canvasSize))
1160
1164
{
1161
1165
auto & io = ImGui::GetIO ();
0 commit comments