diff options
-rw-r--r-- | src/subconscious/graphics/MapScene.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/subconscious/graphics/MapScene.java b/src/subconscious/graphics/MapScene.java index a198542..fb590ac 100644 --- a/src/subconscious/graphics/MapScene.java +++ b/src/subconscious/graphics/MapScene.java @@ -38,8 +38,8 @@ public abstract class MapScene extends Scene { protected AffineTransform applyZoomTx = new AffineTransform(); protected AffineTransform applyPanTx = new AffineTransform(); - protected AffineTransform undoZoomTx; - protected AffineTransform undoPanTx; + protected AffineTransform undoZoomTx = null; + protected AffineTransform undoPanTx = null; // rendering settings protected boolean renderTileBorder = true; @@ -74,6 +74,10 @@ public abstract class MapScene extends Scene { public Point tileAtCoordinates(Point screenPos) { Rectangle mapRect = new Rectangle(0, 0, this.map.getSize(), this.map.getSize()); + if (undoZoomTx == null || undoPanTx == null) { + return null; + } + // undo zoom undoZoomTx.transform(screenPos, screenPos); |