From 698eaa7736d0fde69a90662512e5405539318a88 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 13 Mar 2017 16:20:58 +0200 Subject: [PATCH] Don't change position when restricted by center pin point. --HG-- branch : feature --- src/libs/vwidgets/vtextgraphicsitem.cpp | 30 ++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/libs/vwidgets/vtextgraphicsitem.cpp b/src/libs/vwidgets/vtextgraphicsitem.cpp index 9f2e728ad..041aa8c84 100644 --- a/src/libs/vwidgets/vtextgraphicsitem.cpp +++ b/src/libs/vwidgets/vtextgraphicsitem.cpp @@ -516,15 +516,15 @@ void VTextGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent* pME) // in resize mode, resize the label along the mouse move from the origin QPointF pt; -// if (m_moveType & IsMovable) -// { + if (m_moveType & IsMovable) + { pt = m_ptStartPos; -// } -// else -// { -// pt = m_ptRotCenter - QRectF(0, 0, m_szStart.width() + ptDiff.x(), -// m_szStart.height() + ptDiff.y()).center(); -// } + } + else + { + pt = m_ptRotCenter - QRectF(0, 0, m_szStart.width() + ptDiff.x(), + m_szStart.height() + ptDiff.y()).center(); + } rectBB.setTopLeft(pt); QSizeF sz(m_szStart.width() + ptDiff.x(), m_szStart.height() + ptDiff.y()); @@ -534,13 +534,13 @@ void VTextGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent* pME) { sz = QSizeF(sz.width()+dX, sz.height()+dY); } -// else -// { -// if (not (m_moveType & IsMovable)) -// { -// setPos(pt); -// } -// } + else + { + if (not (m_moveType & IsMovable)) + { + setPos(pt); + } + } SetSize(sz.width(), sz.height()); Update();