From 31a0032162ff1a98e1eaef4c342930cb5ac79ef6 Mon Sep 17 00:00:00 2001 From: creme332 <65414576+creme332@users.noreply.github.com> Date: Fri, 9 Aug 2024 12:19:43 +0400 Subject: [PATCH] fix issue #204 by initializing canvas dimensions --- .../github/creme332/controller/canvas/CanvasController.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/github/creme332/controller/canvas/CanvasController.java b/src/main/java/com/github/creme332/controller/canvas/CanvasController.java index 0f2bac1..26c7a6c 100644 --- a/src/main/java/com/github/creme332/controller/canvas/CanvasController.java +++ b/src/main/java/com/github/creme332/controller/canvas/CanvasController.java @@ -70,6 +70,9 @@ public CanvasController(AppState app, Canvas canvas) { this.canvas = canvas; this.model = app.getCanvasModel(); + // initialize dimensions of canvas + model.setCanvasDimension(new Dimension(canvas.getWidth(), canvas.getHeight())); + // listen to model model.addPropertyChangeListener(this); model.getShapeManager().addPropertyChangeListener(this);