diff --git a/diylc/diylc-core/src/org/diylc/presenter/Presenter.java b/diylc/diylc-core/src/org/diylc/presenter/Presenter.java index 05512279..39b28ab6 100644 --- a/diylc/diylc-core/src/org/diylc/presenter/Presenter.java +++ b/diylc/diylc-core/src/org/diylc/presenter/Presenter.java @@ -1321,19 +1321,23 @@ public class Presenter implements IPlugInPort { Dimension d = drawingManager.getCanvasDimensions(currentProject, 1d, useExtraSpace); double extraSpace = useExtraSpace ? drawingManager.getExtraSpace(currentProject) : 0; + boolean isRigid = true; + List points = new ArrayList(); for (Map.Entry, Set> entry : controlPointMap.entrySet()) { for (Integer i : entry.getValue()) { Point2D p = entry.getKey().getControlPoint(i); + if (entry.getKey().canPointMoveFreely(i)) + isRigid = false; points.add(p); } } Point2D firstPoint = points.iterator().next(); - if (points.size() == 1 || points.stream().allMatch((x) -> x.equals(firstPoint))) { - double avgX = points.stream().mapToDouble((x) -> x.getX()).average().getAsDouble(); - double avgY = points.stream().mapToDouble((x) -> x.getY()).average().getAsDouble(); + if (points.size() == 1 || points.stream().allMatch((x) -> x.equals(firstPoint)) || (controlPointMap.size() == 1 && isRigid)) { + double avgX = firstPoint.getX();//points.stream().mapToDouble((x) -> x.getX()).average().getAsDouble(); + double avgY = firstPoint.getY();//points.stream().mapToDouble((x) -> x.getY()).average().getAsDouble(); Point2D testPoint = new Point2D.Double(avgX + dx, avgY + dy); if (snapToGrid) { diff --git a/diylc/diylc-core/src/org/diylc/presenter/update.xml b/diylc/diylc-core/src/org/diylc/presenter/update.xml index ad7ed372..5674717c 100644 --- a/diylc/diylc-core/src/org/diylc/presenter/update.xml +++ b/diylc/diylc-core/src/org/diylc/presenter/update.xml @@ -3297,6 +3297,10 @@ IMPROVEMENT In cases when there's already a component in the selection that is reduced to nothing, allow moving the selection to avoid getting stuck + + + IMPROVEMENT + Moving a rigid component (e.g. tube/transistor symbol) which is not snapped to grid makes it snap back to the grid when 'Snap to Grid' is switched on IMPROVEMENT diff --git a/diylc/diylc-library/lib/diylc-core.jar b/diylc/diylc-library/lib/diylc-core.jar index 46826fea..76991711 100644 Binary files a/diylc/diylc-library/lib/diylc-core.jar and b/diylc/diylc-library/lib/diylc-core.jar differ