mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Unable to move selected components if one of them is close to being reduced to a point
This commit is contained in:
@@ -62,4 +62,12 @@ public class CalcUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean pointsMatch(Point2D point1, Point2D point2, double delta) {
|
||||
if (Math.abs(point1.getX() - point2.getX()) > delta)
|
||||
return false;
|
||||
if (Math.abs(point1.getY() - point2.getY()) > delta)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1364,7 +1364,7 @@ public class Presenter implements IPlugInPort {
|
||||
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)))
|
||||
if (CalcUtils.pointsMatch(component.getControlPoint(i), component.getControlPoint(j), DrawingManager.CONTROL_POINT_SIZE / 2.0))
|
||||
skip = true;
|
||||
|
||||
if (skip)
|
||||
@@ -1396,7 +1396,8 @@ public class Presenter implements IPlugInPort {
|
||||
|
||||
for (int i = 0; i < controlPoints.length - 1; i++) {
|
||||
for (int j = i + 1; j < controlPoints.length; j++) {
|
||||
if (controlPoints[i] != null && controlPoints[j] != null && controlPoints[i].equals(controlPoints[j])) {
|
||||
if (controlPoints[i] != null && controlPoints[j] != null &&
|
||||
CalcUtils.pointsMatch(controlPoints[i], controlPoints[j], DrawingManager.CONTROL_POINT_SIZE / 2.0)) {
|
||||
// Control points collision detected, cannot make
|
||||
// this move.
|
||||
return null;
|
||||
|
||||
@@ -4369,5 +4369,21 @@
|
||||
</changes>
|
||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||
</org.diylc.appframework.update.Version>
|
||||
<org.diylc.appframework.update.Version>
|
||||
<versionNumber>
|
||||
<major>4</major>
|
||||
<minor>38</minor>
|
||||
<build>0</build>
|
||||
</versionNumber>
|
||||
<releaseDate>2023-04-27 00:00:00.000 CET</releaseDate>
|
||||
<name></name>
|
||||
<changes>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>Unable to move selected components if one of them is close to being reduced to a point</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
</changes>
|
||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||
</org.diylc.appframework.update.Version>
|
||||
</a>
|
||||
</java.util.Arrays_-ArrayList>
|
||||
|
||||
Reference in New Issue
Block a user