fix confusion between circle radius and diameter
classic shite
This commit is contained in:
@@ -57,7 +57,7 @@ public class App {
|
||||
SCollection.of(
|
||||
SRectangle.create(100, 200, 40, 60, Color.MAGENTA),
|
||||
SRectangle.create(150, 200, 40, 60, Color.MAGENTA),
|
||||
SCircle.create(200, 200, 60)
|
||||
SCircle.create(200, 250, 30)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,10 +8,10 @@ import java.awt.*;
|
||||
|
||||
public class SCircle extends AbstractShape {
|
||||
|
||||
private int radius;
|
||||
private final int radius;
|
||||
|
||||
private SCircle(int x, int y, int radius) {
|
||||
super(new Rectangle(x, y, radius, radius));
|
||||
super(new Rectangle(x, y, radius * 2, radius * 2));
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,10 +56,10 @@ public class ShapeDraftman implements ShapeVisitor {
|
||||
}
|
||||
if (colAttrs.filled) {
|
||||
this.g2d.setColor(colAttrs.filledColor);
|
||||
this.g2d.fillOval(bounds.x, bounds.y, circle.getRadius(), circle.getRadius());
|
||||
this.g2d.fillOval(bounds.x, bounds.y, 2 * circle.getRadius(), 2 * circle.getRadius());
|
||||
}
|
||||
if (colAttrs.stroked) this.g2d.setColor(colAttrs.strokedColor);
|
||||
this.g2d.drawOval(bounds.x, bounds.y, circle.getRadius(), circle.getRadius());
|
||||
this.g2d.drawOval(bounds.x, bounds.y, 2 * circle.getRadius(), 2 * circle.getRadius());
|
||||
|
||||
drawHandlerIfSelected(circle);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user