File tree 5 files changed +18
-12
lines changed
basic-interaction-example
5 files changed +18
-12
lines changed Original file line number Diff line number Diff line change 1
1
v0.10.0 (WIP):
2
2
3
+ BREAKING: Editor: Ensure CreateItemAction is not activated fom invalid state, thanks @pthom
4
+ From this point ed::EndCreate() and ed::EndDelete() can only be called when
5
+ ed::BeginCreate() and ed::BeginDelete() calls were successful.
6
+
7
+ BUGFIX: Examples: Call ed::EndCreate() and ed::EndDelete() only when ed::BeginCreate() and ed::BeginDelete() returned true
8
+
3
9
4
10
v0.9.2 (2023-09-01):
5
11
Original file line number Diff line number Diff line change @@ -153,8 +153,8 @@ struct Example:
153
153
// visual feedback by changing link thickness and color.
154
154
}
155
155
}
156
+ ed::EndCreate (); // Wraps up object creation action handling.
156
157
}
157
- ed::EndCreate (); // Wraps up object creation action handling.
158
158
159
159
160
160
// Handle deletion action
@@ -181,9 +181,8 @@ struct Example:
181
181
// You may reject link deletion by calling:
182
182
// ed::RejectDeletedItem();
183
183
}
184
+ ed::EndDelete (); // Wrap up deletion action
184
185
}
185
- ed::EndDelete (); // Wrap up deletion action
186
-
187
186
188
187
189
188
// End of interaction with editor.
Original file line number Diff line number Diff line change @@ -1543,12 +1543,12 @@ struct Example:
1543
1543
ed::Resume ();
1544
1544
}
1545
1545
}
1546
+
1547
+ ed::EndCreate ();
1546
1548
}
1547
1549
else
1548
1550
newLinkPin = nullptr ;
1549
1551
1550
- ed::EndCreate ();
1551
-
1552
1552
if (ed::BeginDelete ())
1553
1553
{
1554
1554
ed::NodeId nodeId = 0 ;
@@ -1572,8 +1572,9 @@ struct Example:
1572
1572
m_Links.erase (id);
1573
1573
}
1574
1574
}
1575
+
1576
+ ed::EndDelete ();
1575
1577
}
1576
- ed::EndDelete ();
1577
1578
}
1578
1579
1579
1580
ImGui::SetCursorScreenPos (cursorTopLeft);
Original file line number Diff line number Diff line change @@ -384,8 +384,8 @@ struct Example:
384
384
}
385
385
}
386
386
}
387
+ ed::EndCreate ();
387
388
}
388
- ed::EndCreate ();
389
389
390
390
// Handle deletion action ---------------------------------------------------------------------------
391
391
if (ed::BeginDelete ())
@@ -405,8 +405,8 @@ struct Example:
405
405
}
406
406
}
407
407
}
408
+ ed::EndDelete ();
408
409
}
409
- ed::EndDelete ();
410
410
411
411
ed::End ();
412
412
ed::SetCurrentEditor (nullptr );
Original file line number Diff line number Diff line change @@ -4709,23 +4709,23 @@ bool ed::CreateItemAction::Begin()
4709
4709
{
4710
4710
IM_ASSERT (false == m_InActive);
4711
4711
4712
+ if (m_NextStage == None)
4713
+ return false ;
4714
+
4712
4715
m_InActive = true ;
4713
4716
m_CurrentStage = m_NextStage;
4714
4717
m_UserAction = Unknown;
4715
4718
m_LinkColor = IM_COL32_WHITE;
4716
4719
m_LinkThickness = 1 .0f ;
4717
4720
4718
- if (m_CurrentStage == None)
4719
- return false ;
4720
-
4721
4721
m_LastChannel = Editor->GetDrawList ()->_Splitter ._Current ;
4722
4722
4723
4723
return true ;
4724
4724
}
4725
4725
4726
4726
void ed::CreateItemAction::End ()
4727
4727
{
4728
- IM_ASSERT (m_InActive);
4728
+ IM_ASSERT (m_InActive && " Please call End() only when Begin() was successful " );
4729
4729
4730
4730
if (m_IsInGlobalSpace)
4731
4731
{
You can’t perform that action at this time.
0 commit comments