Commit 12188ff5 authored by Dmitry Kazakov's avatar Dmitry Kazakov
Browse files

Hide Pseudo Infinite canvas decoration when in Wraparound mode

BUG:335745
parent 765fdbcd
......@@ -838,6 +838,13 @@ bool KisCanvas2::isPopupPaletteVisible()
void KisCanvas2::setWrapAroundViewingMode(bool value)
{
KisCanvasDecoration *infinityDecoration =
m_d->canvasWidget->decoration(INFINITY_DECORATION_ID);
if (infinityDecoration) {
infinityDecoration->setVisible(!value);
}
m_d->canvasWidget->setWrapAroundViewingMode(value);
}
......
......@@ -27,9 +27,9 @@ struct KisCanvasDecoration::Private {
QString name;
};
KisCanvasDecoration::KisCanvasDecoration(const QString& id, const QString& name, KisView2 * parent) : QObject(parent), d(new Private)
KisCanvasDecoration::KisCanvasDecoration(const QString& id, const QString& name, KisView2 * parent, bool visible) : QObject(parent), d(new Private)
{
d->visible = false;
d->visible = visible;
d->view = parent;
d->id = id;
d->name = name;
......
......@@ -39,7 +39,7 @@ class KRITAUI_EXPORT KisCanvasDecoration : public QObject
{
Q_OBJECT
public:
KisCanvasDecoration(const QString& id, const QString& name, KisView2 * parent);
KisCanvasDecoration(const QString& id, const QString& name, KisView2 * parent, bool visible = false);
~KisCanvasDecoration();
const QString& id() const;
const QString& name() const;
......
......@@ -35,8 +35,8 @@
KisInfinityManager::KisInfinityManager(KisView2 *view, KisCanvas2 *canvas)
: KisCanvasDecoration(INFINITY_DECORATION_ID, i18n("Expand into Infinity Decoration"), view),
m_filterInstalled(false),
: KisCanvasDecoration(INFINITY_DECORATION_ID, i18n("Expand into Infinity Decoration"), view, true),
m_filteringEnabled(false),
m_cursorSwitched(false)
{
connect(canvas, SIGNAL(documentOffsetUpdateFinished()), SLOT(imagePositionChanged()));
......@@ -106,14 +106,14 @@ void KisInfinityManager::imagePositionChanged()
visible = true;
}
setVisible(visible);
if (visible && !m_filterInstalled) {
if (visible && !m_filteringEnabled) {
view()->canvasBase()->inputManager()->attachPriorityEventFilter(this);
m_filteringEnabled = true;
}
if (!visible && m_filterInstalled) {
if (!visible && m_filteringEnabled) {
view()->canvasBase()->inputManager()->detachPriorityEventFilter(this);
m_filteringEnabled = false;
}
}
......@@ -123,6 +123,8 @@ void KisInfinityManager::drawDecoration(QPainter& gc, const QRectF& updateArea,
Q_UNUSED(converter);
Q_UNUSED(canvas);
if (!m_filteringEnabled) return;
gc.save();
gc.setTransform(QTransform(), false);
......@@ -150,6 +152,8 @@ void KisInfinityManager::drawDecoration(QPainter& gc, const QRectF& updateArea,
bool KisInfinityManager::eventFilter(QObject *obj, QEvent *event)
{
KIS_ASSERT_RECOVER_NOOP(m_filteringEnabled);
bool retval = false;
switch (event->type()) {
......
......@@ -46,7 +46,7 @@ private:
private:
QPainterPath m_decorationPath;
bool m_filterInstalled;
bool m_filteringEnabled;
bool m_cursorSwitched;
QCursor m_oldCursor;
QVector<QTransform> m_handleTransform;
......
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