Improve empty sheet edge.

User expects to have piece positioned tight to the top left corner of a paper sheet.
This commit is contained in:
Roman Telezhynskyi 2020-03-21 17:28:08 +02:00
parent 4fcbbc99fd
commit 77be615877

View File

@ -278,8 +278,10 @@ QLineF VContour::GlobalEdge(int i) const
const QLineF emptyEdge = EmptySheetEdge(); const QLineF emptyEdge = EmptySheetEdge();
const qreal nShift = emptyEdge.length()/GlobalEdgesCount(); const qreal nShift = emptyEdge.length()/GlobalEdgesCount();
edge = IsPortrait() ? QLineF(nShift*(i-1), emptyEdge.y1(), nShift*i, emptyEdge.y2()) : edge = IsPortrait() ? QLineF(nShift*(i-1) + emptyEdge.x1(), emptyEdge.y1(),
QLineF(emptyEdge.x1(), nShift*(i-1), emptyEdge.x2(), nShift*i); nShift*i + emptyEdge.x1(), emptyEdge.y2()) :
QLineF(emptyEdge.x1(), nShift*(i-1) + emptyEdge.y1(),
emptyEdge.x2(), nShift*i + emptyEdge.y1());
} }
else else
{ {
@ -445,7 +447,7 @@ bool VContour::IsPortrait() const
QLineF VContour::EmptySheetEdge() const QLineF VContour::EmptySheetEdge() const
{ {
const int offset = qRound(accuracyPointOnLine*4.); const int offset = qRound(accuracyPointOnLine*4.);
const int layoutOffset = qCeil(d->layoutWidth - accuracyPointOnLine*4.); const int layoutOffset = qCeil(d->layoutWidth - accuracyPointOnLine*2.);
return IsPortrait() ? QLineF(offset, -layoutOffset, d->paperWidth-offset, -layoutOffset) : return IsPortrait() ? QLineF(offset, -layoutOffset, d->paperWidth-offset, -layoutOffset) :
QLineF(-layoutOffset, offset, -layoutOffset, d->paperHeight-offset); QLineF(-layoutOffset, offset, -layoutOffset, d->paperHeight-offset);
} }