In AutoSegment::expandToMinLength(), ensure that we stay on foundry grid

This commit is contained in:
Jean-Paul Chaput 2021-06-08 12:19:08 +02:00
parent 352ca94483
commit 5f60767486
1 changed files with 5 additions and 0 deletions

View File

@ -1697,8 +1697,13 @@ namespace Anabatic {
return false;
}
DbU::Unit oneGrid = DbU::fromGrid( 1 );
DbU::Unit targetExpand = (techMinLength - segMinLength) / 2 + targetCap;
DbU::Unit sourceExpand = - (techMinLength - segMinLength) / 2 - sourceCap;
if (targetExpand % oneGrid)
targetExpand += oneGrid - targetExpand % oneGrid;
if (sourceExpand % oneGrid)
sourceExpand -= oneGrid + sourceExpand % oneGrid;
if (not span.isEmpty()) {
DbU::Unit shiftLeft = span.getVMax() - (getTargetU() + targetExpand);
if (shiftLeft < 0) {