mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
improved stick mechanism when more than one point is stuck
This commit is contained in:
+15
-9
@@ -593,12 +593,14 @@ public class Presenter implements IPlugInPort {
|
|||||||
.extractComponentTypeFrom(
|
.extractComponentTypeFrom(
|
||||||
(Class<? extends IDIYComponent<?>>) component.getClass());
|
(Class<? extends IDIYComponent<?>>) component.getClass());
|
||||||
|
|
||||||
// Do not process a component if it's already in the map and if it's
|
// Check if there's a control point in the current selection
|
||||||
// locked.
|
// that matches with one of its control points.
|
||||||
if (!controlPointMap.containsKey(component) && !isComponentLocked(component)) {
|
for (int i = 0; i < component.getControlPointCount(); i++) {
|
||||||
// Check if there's a control point in the current selection
|
// Do not process a control point if it's already in the map and
|
||||||
// that matches with one of its control points.
|
// if it's locked.
|
||||||
for (int i = 0; i < component.getControlPointCount(); i++) {
|
if ((!controlPointMap.containsKey(component) || !controlPointMap.get(component)
|
||||||
|
.contains(i))
|
||||||
|
&& !isComponentLocked(component)) {
|
||||||
if (component.isControlPointSticky(i)) {
|
if (component.isControlPointSticky(i)) {
|
||||||
boolean componentMatches = false;
|
boolean componentMatches = false;
|
||||||
for (Map.Entry<IDIYComponent<?>, Set<Integer>> entry : controlPointMap
|
for (Map.Entry<IDIYComponent<?>, Set<Integer>> entry : controlPointMap
|
||||||
@@ -623,8 +625,8 @@ public class Presenter implements IPlugInPort {
|
|||||||
LOG.debug("Including component: " + component);
|
LOG.debug("Including component: " + component);
|
||||||
Set<Integer> indices = new HashSet<Integer>();
|
Set<Integer> indices = new HashSet<Integer>();
|
||||||
// For stretchable components just add the
|
// For stretchable components just add the
|
||||||
// matching component.
|
// matching component. Otherwise, add all control
|
||||||
// Otherwise, add all control points.
|
// points.
|
||||||
if (componentType.isStretchable()) {
|
if (componentType.isStretchable()) {
|
||||||
indices.add(i);
|
indices.add(i);
|
||||||
} else {
|
} else {
|
||||||
@@ -632,7 +634,11 @@ public class Presenter implements IPlugInPort {
|
|||||||
indices.add(k);
|
indices.add(k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
controlPointMap.put(component, indices);
|
if (controlPointMap.containsKey(component)) {
|
||||||
|
controlPointMap.get(component).addAll(indices);
|
||||||
|
} else {
|
||||||
|
controlPointMap.put(component, indices);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user