Skip to content

Commit

Permalink
change number seed on undo/redo (proof of concept)
Browse files Browse the repository at this point in the history
fixes ksnip#308
  • Loading branch information
NicoWeio committed Nov 17, 2022
1 parent 2d27e7d commit 8b4b4cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/annotations/misc/NumberManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ void NumberManager::setNumberSeed(int numberSeed)
{
mNumberSeed = numberSeed;
updateExistingNumbersIfRequired();
emit numberSeedChanged(mNumberSeed);
}

int NumberManager::numberSeed() const
Expand Down
8 changes: 8 additions & 0 deletions src/annotations/undo/AddCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,20 @@ void AddCommand::undo()
{
mAnnotationArea->removeAnnotationItem(mItem);
mItem->hide();

if (auto numberItem = dynamic_cast<BaseAnnotationNumber *>(mItem)) {
mAnnotationArea->numberToolSeedChanged(numberItem->number());
}
}

void AddCommand::redo()
{
mAnnotationArea->addAnnotationItem(mItem);
mItem->show();

if (auto numberItem = dynamic_cast<BaseAnnotationNumber *>(mItem)) {
mAnnotationArea->numberToolSeedChanged(numberItem->number() + 1);
}
}

} // namespace kImageAnnotator

0 comments on commit 8b4b4cd

Please sign in to comment.