A board can no longer be selected, dragged or stretched through its own Underside Display, where dragging it moved the mirror under the mouse and the board went the wrong way

This commit is contained in:
Bane Stojkovic
2026-11-12 14:34:05 +01:00
parent 6e3f72dfb6
commit 86b54509bf
5 changed files with 59 additions and 6 deletions
@@ -768,8 +768,9 @@ public class DrawingManager {
}
/**
* Finds the components that the underside mirror of a board shows at the specified point, top
* first, or none when the point is not in a mirror.
* Finds the components that the underside mirror of a board shows at the specified point and that
* can be edited through it, top first, or none when the point is not in a mirror. The board
* itself is left out (see {@link UndersideMirror#isEditableThrough}).
*
* @param point
* @param project
@@ -789,7 +790,7 @@ public class DrawingManager {
/**
* Finds the components that the underside mirror of the specified board shows at the specified
* point, top first, or none when the point is not in that mirror.
* point, other than the board itself, top first, or none when the point is not in that mirror.
*
* @param point
* @param project
@@ -804,7 +805,7 @@ public class DrawingManager {
return components;
}
for (IDIYComponent<?> component : findComponentsAt(mirrorTx.transform(point, null), project)) {
if (UndersideMirror.isMirrored(board, component)) {
if (UndersideMirror.isEditableThrough(board, component)) {
components.add(component);
}
}
@@ -966,7 +966,7 @@ public class Presenter implements IPlugInPort {
for (int i = currentProject.getComponents().size() - 1; i >= 0; i--) {
IDIYComponent<?> component = currentProject.getComponents().get(i);
if (mirrorBoard != null && selectedComponents.contains(component)
&& !UndersideMirror.isMirrored(mirrorBoard, component)) {
&& !UndersideMirror.isEditableThrough(mirrorBoard, component)) {
continue;
}
for (int pointIndex = 0; pointIndex < component.getControlPointCount(); pointIndex++) {
@@ -160,6 +160,15 @@ public class UndersideMirror {
return false;
}
/**
* @return true when the component can be selected, dragged or stretched through the board's
* mirror: any component the mirror shows except the board itself. The mirror is placed
* relative to the board, so moving the board through it would move the mirror as well.
*/
public static boolean isEditableThrough(IBoard board, IDIYComponent<?> component) {
return component != board && isMirrored(board, component);
}
/**
* @return the boards whose mirror contains the point, the topmost first, which is the one drawn
* over the others where mirrors overlap