Skip to content

Commit

Permalink
Make line width 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Niklas van der Heide committed Jan 18, 2021
1 parent 3a7f8b1 commit 35fda12
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/main/java/ch/weylandinator/util/CircuitCanvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ private void printVoltageSource(CircuitElement element, Point2D location, boolea
lineColor = Color.BLUE;
fillColor = Color.LIGHTBLUE;
}

//fill
gc.setFill(fillColor);
gc.fillOval(x - radius, y - radius, radius * 2, radius * 2);

//line
gc.setStroke(lineColor);
Expand All @@ -168,10 +172,6 @@ private void printVoltageSource(CircuitElement element, Point2D location, boolea
//outline
gc.strokeOval(x - radius, y - radius, radius * 2, radius * 2);

//fill
gc.setFill(fillColor);
gc.fillOval(x - radius, y - radius, radius * 2, radius * 2);

//text
gc.setFill(textColor);
gc.fillText(element.getName(), x + radius + padding, y);
Expand All @@ -197,23 +197,25 @@ private void printResistor(CircuitElement element, Point2D location, boolean sel
fillColor = Color.LIGHTBLUE;
}

//fill
gc.setFill(fillColor);
gc.fillRect(x - width / 2, y - height / 2, width, height);

//lines
gc.setStroke(lineColor);
gc.setLineWidth(2.0);
gc.strokeLine(x, y - height / 2 - padding, x, y - height / 2);
gc.strokeRect(x - width / 2, y - height / 2, width, height);
gc.strokeLine(x, y + height / 2 + padding, x, y + height / 2);
if(element.getChildElements().size() == 0) {
double bottom = Position.getRowY(totalRows-1)+50;
gc.strokeLine(x, y + height / 2, x,bottom);
}

//fill
gc.setFill(fillColor);
gc.fillRect(x - width / 2, y - height / 2, width, height);
//outline
gc.strokeRect(x - width / 2, y - height / 2, width, height);

//text
gc.setFill(textColor);
gc.setLineWidth(2.0);
gc.fillText(element.getName(), x + width/2 + padding, y);

gc.setStroke(Color.BLACK);
Expand Down

0 comments on commit 35fda12

Please sign in to comment.