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) {
@@ -18,7 +18,6 @@ import org.diylc.common.IPlugInPort;
import org.diylc.common.ObjectCache;
import org.diylc.common.Orientation;
import org.diylc.components.AbstractTransparentComponent;
import org.diylc.components.misc.Label;
import org.diylc.components.transform.DIL_ICTransformer;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
+4
View File
@@ -1654,6 +1654,10 @@
<changeType>NEW_FEATURE</changeType>
<description>Ability to set project-wide default font through 'Edit Project Settings' dialog.</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType>
<description>Do not allow creating zero-length components (i.e. traces, lines, etc)</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType>
<description>Hookup wire can be sent to back behind boards</description>