sync edit menu checkbox state with the selected shape
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user