fixed restoring grid preference on undo/redo (fix #2872)

This commit is contained in:
Joshua Ogunyinka 2021-08-28 08:54:00 +04:00
parent dc1c41f176
commit f85f24e847
2 changed files with 7 additions and 1 deletions

View File

@ -13,6 +13,7 @@
#include "app/doc.h"
#include "app/doc_event.h"
#include "app/doc_observer.h"
#include "app/pref/preferences.h"
#include "doc/sprite.h"
namespace app {
@ -31,6 +32,9 @@ void SetGridBounds::onExecute()
{
Sprite* spr = sprite();
spr->setGridBounds(m_newBounds);
Doc* doc = static_cast<Doc*>(spr->document());
auto& docPref = Preferences::instance().document(doc);
docPref.grid.bounds(m_newBounds);
spr->incrementVersion();
}
@ -38,6 +42,9 @@ void SetGridBounds::onUndo()
{
Sprite* spr = sprite();
spr->setGridBounds(m_oldBounds);
Doc* doc = static_cast<Doc*>(spr->document());
auto& docPref = Preferences::instance().document(doc);
docPref.grid.bounds(m_oldBounds);
spr->incrementVersion();
}

View File

@ -131,7 +131,6 @@ void GridSettingsCommand::onExecute(Context* context)
tx.commit();
auto& docPref = Preferences::instance().document(site.document());
docPref.grid.bounds(bounds);
if (!docPref.show.grid()) // Make grid visible
docPref.show.grid(true);
}