Commit c61e01de authored by Dmitry Kazakov's avatar Dmitry Kazakov
Browse files

Do not resync decorations wrapper layer when snap-to-guide/grid changes

Resyncing starts a stroke that interrupts the currently running
user action (e.g. Transform Tool), which is not what the user expects.

BUG:439549
parent 6010423c
......@@ -2035,8 +2035,15 @@ KisGridConfig KisDocument::gridConfig() const
void KisDocument::setGridConfig(const KisGridConfig &config)
{
if (d->gridConfig != config) {
const bool shouldSyncDecorations =
!d->gridConfig.isSameIgnoringSnapping(config);
d->gridConfig = config;
d->syncDecorationsWrapperLayerState();
if (shouldSyncDecorations) {
d->syncDecorationsWrapperLayerState();
}
emit sigGridConfigChanged(config);
}
}
......@@ -2123,8 +2130,15 @@ void KisDocument::setGuidesConfig(const KisGuidesConfig &data)
{
if (d->guidesConfig == data) return;
const bool shouldSyncDecorations =
!d->guidesConfig.isSameIgnoringSnapping(data);
d->guidesConfig = data;
d->syncDecorationsWrapperLayerState();
if (shouldSyncDecorations) {
d->syncDecorationsWrapperLayerState();
}
emit sigGuidesConfigChanged(d->guidesConfig);
}
......
......@@ -55,6 +55,14 @@ void KisGridConfig::transform(const QTransform &transform)
m_offset = KisAlgebra2D::wrapValue(transform.map(m_offset), m_spacing);
}
bool KisGridConfig::isSameIgnoringSnapping(const KisGridConfig &rhs) const
{
KisGridConfig tmp(rhs);
tmp.setSnapToGrid(snapToGrid());
return *this == tmp;
}
void KisGridConfig::loadStaticData()
{
KisConfig cfg(true);
......
......@@ -205,6 +205,8 @@ public:
/// Used with image-wide transformations.
void transform(const QTransform &transform);
bool isSameIgnoringSnapping(const KisGridConfig &rhs) const;
private:
static Qt::PenStyle toPenStyle(LineTypeInternal type) {
return type == LINE_SOLID ? Qt::SolidLine :
......
......@@ -343,3 +343,11 @@ void KisGuidesConfig::transform(const QTransform &transform)
d->horzGuideLines = newHorzGuideLines;
d->vertGuideLines = newVertGuideLines;
}
bool KisGuidesConfig::isSameIgnoringSnapping(const KisGuidesConfig &rhs) const
{
KisGuidesConfig tmp(rhs);
tmp.setSnapToGuides(snapToGuides());
return *this == tmp;
}
......@@ -113,6 +113,8 @@ public:
/// Used with image-wide transformations.
void transform(const QTransform &transform);
bool isSameIgnoringSnapping(const KisGuidesConfig &rhs) const;
private:
class Private;
const QScopedPointer<Private> d;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment