Fixed issues when creating leaded components using drag and drop with

'Snap to Grid' option switched on using a metric grid spacing (e.g. 1mm)
This commit is contained in:
bancika
2020-12-12 22:40:21 +01:00
parent 7dd63ba2d8
commit e52873fc50
10 changed files with 37 additions and 4 deletions
@@ -52,6 +52,7 @@ import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.annotations.PositiveNonZeroMeasureValidator;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
import org.diylc.presenter.CalcUtils;
import org.diylc.utils.Constants;
/**
@@ -102,6 +103,13 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
}
points[2] = calculateLabelPosition(points[0], points[1]);
}
@Override
public void createdIn(Project project) {
double targetSize = CalcUtils.findClosestMultiplierOf(project.getGridSpacing(), DEFAULT_SIZE, 2).convertToPixels();
points[0]= new Point2D.Double(-targetSize / 2, 0);
points[1] = new Point2D.Double(targetSize / 2, 0);
}
protected boolean IsCopperArea() {
return false;