Do not allow creating zero-length components

This commit is contained in:
bancika
2017-04-19 10:36:06 +02:00
parent cbd58a1dd8
commit 32e273df6e
3 changed files with 8 additions and 1 deletions
@@ -503,6 +503,10 @@ public class Presenter implements IPlugInPort {
// On the second click, add the component to the
// project.
List<IDIYComponent<?>> componentSlot = instantiationManager.getComponentSlot();
Point firstPoint = componentSlot.get(0).getControlPoint(0);
// don't allow to create component with the same points
if (scaledPoint.equals(firstPoint))
return;
componentSlot.get(0).setControlPoint(scaledPoint, 1);
List<IDIYComponent<?>> newSelection = new ArrayList<IDIYComponent<?>>();
for (IDIYComponent<?> component : componentSlot) {