Fix label size for case with two pins.

This commit is contained in:
Roman Telezhynskyi 2020-09-23 16:54:06 +03:00
parent b83fec62bf
commit 64f70a58cf
2 changed files with 4 additions and 11 deletions

View file

@ -37,6 +37,7 @@
- Incorrect conversion to newer curve format. - Incorrect conversion to newer curve format.
- Elide a variable description in the formula wizard. - Elide a variable description in the formula wizard.
- Fix removing a pin in the Seam Allowance tool dialog. - Fix removing a pin in the Seam Allowance tool dialog.
- Fix label size for case with two pins.
# Version 0.6.1 October 23, 2018 # Version 0.6.1 October 23, 2018
- [#885] Regression. Broken support for multi size measurements. - [#885] Regression. Broken support for multi size measurements.

View file

@ -124,9 +124,11 @@ bool FindLabelGeometry(const VPatternLabelData &labelData, const VContainer *pat
{ {
Calculator cal1; Calculator cal1;
labelWidth = cal1.EvalFormula(pattern->DataVariables(), labelData.GetLabelWidth()); labelWidth = cal1.EvalFormula(pattern->DataVariables(), labelData.GetLabelWidth());
labelWidth = ToPixel(labelWidth, *pattern->GetPatternUnit());
Calculator cal2; Calculator cal2;
labelHeight = cal2.EvalFormula(pattern->DataVariables(), labelData.GetLabelHeight()); labelHeight = cal2.EvalFormula(pattern->DataVariables(), labelData.GetLabelHeight());
labelHeight = ToPixel(labelHeight, *pattern->GetPatternUnit());
} }
catch(qmu::QmuParserError &e) catch(qmu::QmuParserError &e)
{ {
@ -140,11 +142,7 @@ bool FindLabelGeometry(const VPatternLabelData &labelData, const VContainer *pat
try try
{ {
const auto centerPinPoint = pattern->GeometricObject<VPointF>(centerPin); const auto centerPinPoint = pattern->GeometricObject<VPointF>(centerPin);
pos = static_cast<QPointF>(*centerPinPoint) - QRectF(0, 0, labelWidth, labelHeight).center();
const qreal lWidth = ToPixel(labelWidth, *pattern->GetPatternUnit());
const qreal lHeight = ToPixel(labelHeight, *pattern->GetPatternUnit());
pos = static_cast<QPointF>(*centerPinPoint) - QRectF(0, 0, lWidth, lHeight).center();
} }
catch(const VExceptionBadId &) catch(const VExceptionBadId &)
{ {
@ -587,9 +585,6 @@ void VLayoutPiece::SetPieceText(const QString& qsName, const VPieceLabelData& da
return; return;
} }
labelWidth = ToPixel(labelWidth, *pattern->GetPatternUnit());
labelHeight = ToPixel(labelHeight, *pattern->GetPatternUnit());
QVector<QPointF> v; QVector<QPointF> v;
v << ptPos v << ptPos
<< QPointF(ptPos.x() + labelWidth, ptPos.y()) << QPointF(ptPos.x() + labelWidth, ptPos.y())
@ -648,9 +643,6 @@ void VLayoutPiece::SetPatternInfo(VAbstractPattern* pDoc, const VPatternLabelDat
return; return;
} }
labelWidth = ToPixel(labelWidth, *pattern->GetPatternUnit());
labelHeight = ToPixel(labelHeight, *pattern->GetPatternUnit());
QVector<QPointF> v; QVector<QPointF> v;
v << ptPos v << ptPos
<< QPointF(ptPos.x() + labelWidth, ptPos.y()) << QPointF(ptPos.x() + labelWidth, ptPos.y())