In cases when there's already a component in the selection that is

reduced to nothing, allow moving the selection
This commit is contained in:
bancika
2020-12-11 21:06:23 +01:00
parent f386d79a26
commit e4bdb820d4
2 changed files with 14 additions and 0 deletions
@@ -1359,7 +1359,17 @@ public class Presenter implements IPlugInPort {
// Validate if moving can be done. // Validate if moving can be done.
for (Map.Entry<IDIYComponent<?>, Set<Integer>> entry : controlPointMap.entrySet()) { for (Map.Entry<IDIYComponent<?>, Set<Integer>> entry : controlPointMap.entrySet()) {
// check if a component already has overlapping points because of a previous error, in that case skip it
boolean skip = false;
IDIYComponent<?> component = entry.getKey(); IDIYComponent<?> component = entry.getKey();
for (int i = 0; i < component.getControlPointCount() - 1 && !skip; i++)
for (int j = i + 1; j < component.getControlPointCount() && !skip; j++)
if (component.getControlPoint(i).equals(component.getControlPoint(j)))
skip = true;
if (skip)
continue;
Point2D[] controlPoints = new Point2D[component.getControlPointCount()]; Point2D[] controlPoints = new Point2D[component.getControlPointCount()];
for (int index = 0; index < component.getControlPointCount(); index++) { for (int index = 0; index < component.getControlPointCount(); index++) {
Point2D p = component.getControlPoint(index); Point2D p = component.getControlPoint(index);
@@ -3301,6 +3301,10 @@
<org.diylc.appframework.update.Change> <org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType> <changeType>IMPROVEMENT</changeType>
<description>Do not allow for components like traces, jumpers and wires to be reduced to nothing by dragging connected components</description> <description>Do not allow for components like traces, jumpers and wires to be reduced to nothing by dragging connected components</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType>
<description>In cases when there's already a component in the selection that is reduced to nothing, allow moving the selection</description>
</org.diylc.appframework.update.Change> </org.diylc.appframework.update.Change>
</changes> </changes>
<url>https://github.com/bancika/diy-layout-creator/releases</url> <url>https://github.com/bancika/diy-layout-creator/releases</url>