handle multiple selection with shift

This commit is contained in:
2025-02-19 13:44:23 +01:00
parent 5f0bcda8ba
commit 02dd84c1f4
6 changed files with 70 additions and 38 deletions

View File

@@ -29,11 +29,6 @@ public abstract class AbstractShape implements Shape {
attributes.put(attrs.getID(), attrs);
}
@Override
public void setLoc(Point newLoc) {
getBounds().setLocation(newLoc);
}
@Override
public void translate(int dx, int dy) {
getBounds().translate(dx, dy);

View File

@@ -12,7 +12,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Spliterator;
import java.util.stream.Collectors;
public class SCollection extends AbstractShape implements Streamable<Shape> {
private final static Logger logger = LoggerFactory.getLogger(SCollection.class);
@@ -53,9 +52,8 @@ public class SCollection extends AbstractShape implements Streamable<Shape> {
}
@Override
public void setLoc(Point newLoc) {
final Point loc = getBounds().getLocation();
children.forEach(s -> s.translate(newLoc.x - loc.x, newLoc.y - loc.y));
public void translate(int dx, int dy) {
children.forEach(s -> s.translate(dx, dy));
}
@Override

View File

@@ -7,7 +7,6 @@ import java.awt.*;
public interface Shape {
void accept(ShapeVisitor visitor);
void setLoc(Point newLoc);
void translate(int dx, int dy);
Attributes getAttributes(String key);
void addAttributes(Attributes attr);