mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
improved piece of code
This commit is contained in:
+6
-7
@@ -585,16 +585,14 @@ public class Presenter implements IPlugInPort {
|
||||
int oldSize = controlPointMap.size();
|
||||
LOG.debug("Expanding selected component map");
|
||||
for (IDIYComponent<?> component : currentProject.getComponents()) {
|
||||
// Do not process a component if it's already in the map.
|
||||
ComponentType componentType = componentTypeMap.get(component.getClass().getName());
|
||||
|
||||
// Do not process a component if it's already in the map.
|
||||
if (!controlPointMap.containsKey(component)) {
|
||||
// Check if there's a control point in the current selection
|
||||
// that matches with one of its control points.
|
||||
for (int i = 0; i < component.getControlPointCount(); i++) {
|
||||
if (controlPointMap.containsKey(component)) {
|
||||
break;
|
||||
}
|
||||
if (!controlPointMap.containsKey(component) && component.isControlPointSticky(i)) {
|
||||
if (component.isControlPointSticky(i)) {
|
||||
boolean componentMatches = false;
|
||||
for (Map.Entry<IDIYComponent<?>, Set<Integer>> entry : controlPointMap
|
||||
.entrySet()) {
|
||||
@@ -605,8 +603,8 @@ public class Presenter implements IPlugInPort {
|
||||
Point firstPoint = component.getControlPoint(i);
|
||||
if (entry.getKey().isControlPointSticky(j)) {
|
||||
Point secondPoint = entry.getKey().getControlPoint(j);
|
||||
// If they are close enough we can consider them
|
||||
// matched.
|
||||
// If they are close enough we can consider
|
||||
// them matched.
|
||||
if (firstPoint.distance(secondPoint) < DrawingManager.CONTROL_POINT_SIZE) {
|
||||
componentMatches = true;
|
||||
break;
|
||||
@@ -632,6 +630,7 @@ public class Presenter implements IPlugInPort {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int newSize = controlPointMap.size();
|
||||
// As long as we're adding new components, do another iteration.
|
||||
if (newSize > oldSize) {
|
||||
|
||||
Reference in New Issue
Block a user