Fix bug with resize rectangle. Wrong scale factor.
--HG-- branch : feature
This commit is contained in:
parent
cf47ab8aa9
commit
f48325cc52
|
@ -145,6 +145,7 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption
|
||||||
if (m_eMode != mRotate)
|
if (m_eMode != mRotate)
|
||||||
{
|
{
|
||||||
pP->setBrush(clr);
|
pP->setBrush(clr);
|
||||||
|
UpdatePolyResize();
|
||||||
pP->drawPolygon(m_polyResize);
|
pP->drawPolygon(m_polyResize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,23 +566,7 @@ void VGrainlineItem::UpdateRectangle()
|
||||||
m_rectBoundingBox = m_polyBound.boundingRect();
|
m_rectBoundingBox = m_polyBound.boundingRect();
|
||||||
setTransformOriginPoint(m_rectBoundingBox.center());
|
setTransformOriginPoint(m_rectBoundingBox.center());
|
||||||
|
|
||||||
m_polyResize.clear();
|
UpdatePolyResize();
|
||||||
QPointF ptA = m_polyBound.at(1);
|
|
||||||
m_polyResize << ptA;
|
|
||||||
const double dSize = m_dScale * RESIZE_RECT_SIZE;
|
|
||||||
|
|
||||||
ptA.setX(ptA.x() - dSize*cos(m_dRotation - M_PI/2));
|
|
||||||
ptA.setY(ptA.y() + dSize*sin(m_dRotation - M_PI/2));
|
|
||||||
m_polyResize << ptA;
|
|
||||||
|
|
||||||
ptA.setX(ptA.x() + dSize*cos(m_dRotation));
|
|
||||||
ptA.setY(ptA.y() - dSize*sin(m_dRotation));
|
|
||||||
m_polyResize << ptA;
|
|
||||||
|
|
||||||
ptA.setX(ptA.x() - dSize*cos(m_dRotation + M_PI/2));
|
|
||||||
ptA.setY(ptA.y() + dSize*sin(m_dRotation + M_PI/2));
|
|
||||||
m_polyResize << ptA;
|
|
||||||
|
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -765,3 +750,24 @@ void VGrainlineItem::UserMoveAndResize(const QPointF &pos)
|
||||||
SetOverrideCursor(cursorArrowCloseHand, 1, 1);
|
SetOverrideCursor(cursorArrowCloseHand, 1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VGrainlineItem::UpdatePolyResize()
|
||||||
|
{
|
||||||
|
m_polyResize.clear();
|
||||||
|
QPointF ptA = m_polyBound.at(1);
|
||||||
|
m_polyResize << ptA;
|
||||||
|
const double dSize = m_dScale * RESIZE_RECT_SIZE;
|
||||||
|
|
||||||
|
ptA.setX(ptA.x() - dSize*cos(m_dRotation - M_PI/2));
|
||||||
|
ptA.setY(ptA.y() + dSize*sin(m_dRotation - M_PI/2));
|
||||||
|
m_polyResize << ptA;
|
||||||
|
|
||||||
|
ptA.setX(ptA.x() + dSize*cos(m_dRotation));
|
||||||
|
ptA.setY(ptA.y() - dSize*sin(m_dRotation));
|
||||||
|
m_polyResize << ptA;
|
||||||
|
|
||||||
|
ptA.setX(ptA.x() - dSize*cos(m_dRotation + M_PI/2));
|
||||||
|
ptA.setY(ptA.y() + dSize*sin(m_dRotation + M_PI/2));
|
||||||
|
m_polyResize << ptA;
|
||||||
|
}
|
||||||
|
|
|
@ -93,6 +93,8 @@ private:
|
||||||
void AllUserModifications(const QPointF &pos);
|
void AllUserModifications(const QPointF &pos);
|
||||||
void UserRotateAndMove();
|
void UserRotateAndMove();
|
||||||
void UserMoveAndResize(const QPointF &pos);
|
void UserMoveAndResize(const QPointF &pos);
|
||||||
|
|
||||||
|
void UpdatePolyResize();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VGRAINLINEITEM_H
|
#endif // VGRAINLINEITEM_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user