Fix positioning a transformation origin for a background image.

This commit is contained in:
Roman Telezhynskyi 2022-11-22 09:57:47 +02:00
parent 3e64af6443
commit 6e924ba0fa
2 changed files with 10 additions and 1 deletions

View File

@ -178,7 +178,10 @@ void VBackgroundImageControls::UpdateControls()
prepareGeometryChange();
m_image = m_doc->GetBackgroundImage(m_id);
m_originPos = m_image.BoundingRect().center();
if(not m_customOrigin)
{
m_originPos = m_image.BoundingRect().center();
}
}
//---------------------------------------------------------------------------------------------------------------------
@ -394,6 +397,8 @@ void VBackgroundImageControls::mousePressEvent(QGraphicsSceneMouseEvent *event)
//---------------------------------------------------------------------------------------------------------------------
void VBackgroundImageControls::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
m_customOrigin = true;
if (m_tranformationType == BITransformationType::Scale)
{
ScaleImage(event);
@ -426,8 +431,10 @@ void VBackgroundImageControls::mouseReleaseEvent(QGraphicsSceneMouseEvent *event
setCursor(VAbstractValApplication::VApp()->getSceneView()->viewport()->cursor());
}
m_customOrigin = false;
m_controlsVisible = true;
m_allowChangeMerge = false;
m_originSaved = false;
if (m_tranformationType == BITransformationType::Scale)
{

View File

@ -131,6 +131,8 @@ private:
bool m_showOrigin{false};
QPointF m_originPos{};
bool m_originSaved{false};
bool m_customOrigin{false};
void InitPixmaps();