This commit is contained in:
2018-08-27 15:59:26 +02:00
parent ce474b4f02
commit dcc11a4652

View File

@@ -129,8 +129,8 @@ public class PuckGraphics {
//All pucks
if (basePlateGraphics!=null) {
Rectangle rect = basePlateGraphics.getBoundingBox(); //TODO
int ret = Math.min((int) ((puck.getSize().getWidth() / basePlate.getSize().getWidth()) * rect.width),
(int) ((puck.getSize().getHeight() / basePlate.getSize().getHeight()) * rect.height)
int ret = Math.min((int) Math.round(((double)puck.getSize().getWidth() / basePlate.getSize().getWidth()) * rect.width),
(int) Math.round(((double)puck.getSize().getHeight() / basePlate.getSize().getHeight()) * rect.height)
);
if (puck.isSelected()) {
ret += 2;
@@ -155,8 +155,8 @@ public class PuckGraphics {
Rectangle rect = basePlateGraphics.getBoundingBox();
DimensionDouble plateSize = basePlate.getSize();
PointDouble pos = basePlate.getPuckPosition(puck);
return new Point((int) ((pos.x / plateSize.getWidth()) * rect.width + rect.getCenterX()),
(int) ((pos.y / plateSize.getHeight()) * rect.height + rect.getCenterY())
return new Point( (int) Math.round(((double)pos.x / plateSize.getWidth()) * rect.width + rect.getCenterX()),
(int) Math.round(((double)pos.y / plateSize.getHeight()) * rect.height + rect.getCenterY())
);
} else {
//Single puck plot
@@ -249,9 +249,12 @@ public class PuckGraphics {
position = getReferenceDrawPosition();
size = getReferenceDrawSize();
//size+=1;
g.fillArc(position.x - size / 2, position.y - size / 2 , size, size, (int) (180 + (rotated ? puck.angle : 0)), 180);
g.fillOval(position.x - size / 2, position.y - size / 2, size, size);
g.setColor(getBorderColor(drawBackground));
g.drawArc(position.x - size / 2, position.y - size / 2 , size, size, (int) (180 + (rotated ? puck.angle : 0)), 180);
//size-=1;
g.setStroke(new BasicStroke(getBorderWidth(drawBackground)));
g.drawArc(position.x - size / 2, position.y - size / 2 , size, size, (int) (194 + (rotated ? puck.angle : 0)), 152);
g.setStroke(new BasicStroke(1f));
} else {
Point pu = getDrawUnipuckLedPosition();
Point pm = getDrawMinispineLedPosition();