mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-07 12:24:58 +10:00
When a component that belongs to a group is stuck to another component, moving that other component now drags the whole group along instead of only the stuck component
This commit is contained in:
@@ -1445,6 +1445,7 @@ public class Presenter implements IPlugInPort {
|
||||
} else {
|
||||
controlPointMap.put(component, indices);
|
||||
}
|
||||
includeGroupedComponents(component, controlPointMap, excludedComponents);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1482,6 +1483,34 @@ public class Presenter implements IPlugInPort {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A group moves as a single rigid unit, so when one member is dragged along by a stuck control
|
||||
* point the rest of the group has to follow with all of its control points.
|
||||
*/
|
||||
private void includeGroupedComponents(IDIYComponent<?> component,
|
||||
Map<IDIYComponent<?>, Set<Integer>> controlPointMap,
|
||||
Set<IDIYComponent<?>> excludedComponents) {
|
||||
Set<IDIYComponent<?>> groupedComponents = findAllGroupedComponents(component);
|
||||
if (groupedComponents.size() <= 1) {
|
||||
return;
|
||||
}
|
||||
for (IDIYComponent<?> groupedComponent : groupedComponents) {
|
||||
if (isComponentLocked(groupedComponent) || !isComponentVisible(groupedComponent)
|
||||
|| excludedComponents.contains(groupedComponent)
|
||||
|| groupedComponent.getControlPointCount() == 0) {
|
||||
continue;
|
||||
}
|
||||
Set<Integer> indices = controlPointMap.get(groupedComponent);
|
||||
if (indices == null) {
|
||||
indices = new HashSet<Integer>();
|
||||
controlPointMap.put(groupedComponent, indices);
|
||||
}
|
||||
for (int k = 0; k < groupedComponent.getControlPointCount(); k++) {
|
||||
indices.add(k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSnapToGrid() {
|
||||
String snapTo = configManager.readString(IPlugInPort.SNAP_TO_KEY, IPlugInPort.SNAP_TO_DEFAULT);
|
||||
if (this.dragAction == IPlugInPort.DND_TOGGLE_SNAP)
|
||||
|
||||
@@ -621,6 +621,10 @@
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>Fixed the issue of disappearing components in some edge cases</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>When a component that belongs to a group is stuck to another component, moving that other component now drags the whole group along instead of only the stuck component</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
</changes>
|
||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||
</org.diylc.appframework.update.Version>
|
||||
|
||||
Reference in New Issue
Block a user