Fix bug with resizing free grainline.
--HG-- branch : feature
This commit is contained in:
parent
76748f7688
commit
88b56f5453
|
@ -786,6 +786,7 @@ void VToolSeamAllowance::SaveResizeGrainline(qreal dLength)
|
||||||
VPiece newDet = oldDet;
|
VPiece newDet = oldDet;
|
||||||
|
|
||||||
dLength = FromPixel(dLength, *VDataTool::data.GetPatternUnit());
|
dLength = FromPixel(dLength, *VDataTool::data.GetPatternUnit());
|
||||||
|
newDet.GetGrainlineGeometry().SetPos(m_grainLine->pos());
|
||||||
newDet.GetGrainlineGeometry().SetLength(QString().setNum(dLength));
|
newDet.GetGrainlineGeometry().SetLength(QString().setNum(dLength));
|
||||||
SavePieceOptions* resizeCommand = new SavePieceOptions(oldDet, newDet, doc, id);
|
SavePieceOptions* resizeCommand = new SavePieceOptions(oldDet, newDet, doc, id);
|
||||||
resizeCommand->setText(tr("resize grainline"));
|
resizeCommand->setText(tr("resize grainline"));
|
||||||
|
|
|
@ -381,7 +381,7 @@ void VGrainlineItem::mouseMoveEvent(QGraphicsSceneMouseEvent* pME)
|
||||||
{
|
{
|
||||||
qreal dLen = qSqrt(ptDiff.x()*ptDiff.x() + ptDiff.y()*ptDiff.y());
|
qreal dLen = qSqrt(ptDiff.x()*ptDiff.x() + ptDiff.y()*ptDiff.y());
|
||||||
qreal dAng = qAtan2(-ptDiff.y(), ptDiff.x());
|
qreal dAng = qAtan2(-ptDiff.y(), ptDiff.x());
|
||||||
dLen = dLen*qCos(dAng - m_dRotation);
|
dLen = -dLen*qCos(dAng - m_dRotation);
|
||||||
qreal dPrevLen = m_dLength;
|
qreal dPrevLen = m_dLength;
|
||||||
// try with new length
|
// try with new length
|
||||||
if (not (m_moveType & IsMovable))
|
if (not (m_moveType & IsMovable))
|
||||||
|
@ -394,7 +394,12 @@ void VGrainlineItem::mouseMoveEvent(QGraphicsSceneMouseEvent* pME)
|
||||||
|
|
||||||
if (m_moveType & IsMovable)
|
if (m_moveType & IsMovable)
|
||||||
{
|
{
|
||||||
pos = m_ptStartPos;
|
QLineF grainline(this->pos().x(), this->pos().y(),
|
||||||
|
this->pos().x() + dPrevLen, this->pos().y());
|
||||||
|
grainline.setAngle(qRadiansToDegrees(m_dRotation));
|
||||||
|
grainline = QLineF(grainline.p2(), grainline.p1());
|
||||||
|
grainline.setLength(m_dLength);
|
||||||
|
pos = grainline.p2();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -415,12 +420,9 @@ void VGrainlineItem::mouseMoveEvent(QGraphicsSceneMouseEvent* pME)
|
||||||
m_dLength = dPrevLen;
|
m_dLength = dPrevLen;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if (not (m_moveType & IsMovable))
|
|
||||||
{
|
{
|
||||||
setPos(pos);
|
setPos(pos);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
UpdateRectangle();
|
UpdateRectangle();
|
||||||
Update();
|
Update();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user