Skip to content

Commit

Permalink
Switched to static size
Browse files Browse the repository at this point in the history
The image is cropped anyways. This improves resizing
  • Loading branch information
ByteHamster committed Feb 15, 2018
1 parent c4a8936 commit 2050554
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/com/bytehamster/drawingpad/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void start(Stage primaryStage) {
new Separator(Orientation.VERTICAL),
linesEnabledCheck);

Platform.runLater(() -> addCanvas(root));
addCanvas(root);
}

private Button rubberButton() {
Expand Down Expand Up @@ -117,10 +117,13 @@ public static void main(String[] args) {
}

private void addCanvas(BorderPane root) {
canvas = new Canvas(root.getWidth(), root.getHeight());
if (canvas == null) {
canvas = new Canvas(1000,1000);
root.setCenter(canvas);
}
graphicsContext = canvas.getGraphicsContext2D();
graphicsContext.setFill(Color.WHITE);
graphicsContext.fillRect(0,0, root.getWidth(), root.getHeight());
graphicsContext.fillRect(0,0, 1000, 1000);
graphicsContext.setStroke(Color.BLACK);
graphicsContext.setLineWidth(3);

Expand Down Expand Up @@ -170,7 +173,6 @@ private void addCanvas(BorderPane root) {
graphicsContext.closePath();
checkLine();
});
root.setCenter(canvas);
}

private void undo() {
Expand Down

0 comments on commit 2050554

Please sign in to comment.