Skip to content

Commit 7b05358

Browse files
authored
Merge pull request #3395 from pojienie/fix-undo-data-in-arc-and-multiarc-shape
fix undo data when drawing arc and mutliarc
2 parents 32af317 + 1e5f57e commit 7b05358

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

toonz/sources/tnztools/geometrictool.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2376,8 +2376,9 @@ void MultiArcPrimitive::leftButtonUp(const TPointD &pos, const TMouseEvent &) {
23762376
TPointD newPos = getSnap(pos);
23772377

23782378
std::vector<TThickPoint> points(9);
2379-
double thick = getThickness();
2380-
double dist = joinDistance * joinDistance;
2379+
double thick = getThickness();
2380+
double dist = joinDistance * joinDistance;
2381+
bool strokeAdded = false;
23812382

23822383
MultiArcPrimitiveUndo *undo =
23832384
new MultiArcPrimitiveUndo(this, m_stroke, m_strokeTemp, m_startPoint,
@@ -2448,6 +2449,7 @@ void MultiArcPrimitive::leftButtonUp(const TPointD &pos, const TMouseEvent &) {
24482449
m_undoCount = 0;
24492450
m_tool->addStroke();
24502451
onDeactivate();
2452+
strokeAdded = true;
24512453
}
24522454
} else {
24532455
m_stroke = m_strokeTemp;
@@ -2461,14 +2463,19 @@ void MultiArcPrimitive::leftButtonUp(const TPointD &pos, const TMouseEvent &) {
24612463
m_undoCount = 0;
24622464
m_tool->addStroke();
24632465
onDeactivate();
2466+
strokeAdded = true;
24642467
}
24652468
break;
24662469
}
24672470

2468-
undo->setRedoData(m_stroke, m_strokeTemp, m_startPoint, m_endPoint,
2469-
m_centralPoint, m_clickNumber);
2470-
TUndoManager::manager()->add(undo);
2471-
++m_undoCount;
2471+
if (strokeAdded) {
2472+
delete undo;
2473+
} else {
2474+
undo->setRedoData(m_stroke, m_strokeTemp, m_startPoint, m_endPoint,
2475+
m_centralPoint, m_clickNumber);
2476+
TUndoManager::manager()->add(undo);
2477+
++m_undoCount;
2478+
}
24722479

24732480
resetSnap();
24742481
}

0 commit comments

Comments
 (0)