Implement copy action
This commit is contained in:
@@ -24,14 +24,19 @@ public class SRectangle extends AbstractShape {
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public Shape clone() {
|
||||
var color = (ColorAttributes) this.getAttributes(ColorAttributes.ID);
|
||||
return SRectangle.create(super.getBounds().x, super.getBounds().y, getBounds().width, getBounds().height, color.strokedColor);
|
||||
}
|
||||
|
||||
public static SRectangle create(int x, int y, int width, int height) {
|
||||
SRectangle rect = new SRectangle(new Rectangle(x, y, width, height));
|
||||
rect.addAttributes(new SelectionAttributes());
|
||||
return rect;
|
||||
return create(x, y, width, height, Color.BLACK);
|
||||
}
|
||||
|
||||
public static SRectangle create(int x, int y, int width, int height, Color color) {
|
||||
final SRectangle rect = create(x, y, width, height);
|
||||
SRectangle rect = new SRectangle(new Rectangle(x, y, width, height));
|
||||
rect.addAttributes(new SelectionAttributes());
|
||||
rect.addAttributes(new ColorAttributes(false, true, Color.BLACK, color));
|
||||
return rect;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user