sync edit menu checkbox state with the selected shape

This commit is contained in:
2026-03-19 16:06:01 +01:00
parent ce6d0b0815
commit dd59c7d51a
8 changed files with 113 additions and 16 deletions

View File

@@ -7,6 +7,7 @@ import ovh.gasser.newshapes.Selection;
import ovh.gasser.newshapes.attributes.ColorAttributes;
import ovh.gasser.newshapes.shapes.SCollection;
import ovh.gasser.newshapes.shapes.Shape;
import ovh.gasser.newshapes.ui.listeners.SelectionListener;
import java.awt.*;
import java.awt.event.KeyAdapter;
@@ -21,6 +22,7 @@ public class Controller {
private final ShapesView view;
private final SCollection model;
private final Selection selection;
private Point lastMousePos;
Controller(ShapesView view, SCollection model) {
@@ -139,10 +141,13 @@ public class Controller {
selection.clear();
}
public void addSelectionChangeListener(SelectionListener listener) {
selection.addListener(listener);
}
private Optional<Shape> getTarget(MouseEvent evt, SCollection sc) {
return sc.stream()
.filter(s -> s.getBounds().contains(evt.getPoint()))
.findFirst();
}
}