diff --git a/ICGE-Simulation/src/main/java/de/unistuttgart/informatik/fius/icge/simulation/internal/StandardSimulationProxy.java b/ICGE-Simulation/src/main/java/de/unistuttgart/informatik/fius/icge/simulation/internal/StandardSimulationProxy.java index 178a33d3a..4b133f51c 100644 --- a/ICGE-Simulation/src/main/java/de/unistuttgart/informatik/fius/icge/simulation/internal/StandardSimulationProxy.java +++ b/ICGE-Simulation/src/main/java/de/unistuttgart/informatik/fius/icge/simulation/internal/StandardSimulationProxy.java @@ -197,6 +197,7 @@ public void setTaskSelectorListener(TaskSelectorListener listener) { @Override public void selectedTaskChange(String element) { if (!element.equals(this.currentTaskName)) { + this.gameWindow.getPlayfieldDrawer().resetZoomAndPan(); this.switchTask(element); } } diff --git a/ICGE-Ui/src/main/java/de/unistuttgart/informatik/fius/icge/ui/PlayfieldDrawer.java b/ICGE-Ui/src/main/java/de/unistuttgart/informatik/fius/icge/ui/PlayfieldDrawer.java index 0c7f9533c..4b101f0e5 100644 --- a/ICGE-Ui/src/main/java/de/unistuttgart/informatik/fius/icge/ui/PlayfieldDrawer.java +++ b/ICGE-Ui/src/main/java/de/unistuttgart/informatik/fius/icge/ui/PlayfieldDrawer.java @@ -36,4 +36,9 @@ public interface PlayfieldDrawer { * The number of the current tick */ void draw(long tickCount); + + /** + * Reset Zoom and Pan applied by the user to the default values. + */ + public void resetZoomAndPan(); } diff --git a/ICGE-Ui/src/main/java/de/unistuttgart/informatik/fius/icge/ui/internal/SwingPlayfieldDrawer.java b/ICGE-Ui/src/main/java/de/unistuttgart/informatik/fius/icge/ui/internal/SwingPlayfieldDrawer.java index 8f7e91037..6471ad94c 100644 --- a/ICGE-Ui/src/main/java/de/unistuttgart/informatik/fius/icge/ui/internal/SwingPlayfieldDrawer.java +++ b/ICGE-Ui/src/main/java/de/unistuttgart/informatik/fius/icge/ui/internal/SwingPlayfieldDrawer.java @@ -227,6 +227,13 @@ public void draw(long tickCount) { this.repaintManager.setDoubleBufferingEnabled(bufferEnabled); } + @Override + public void resetZoomAndPan() { + this.scale = 1.0; + this.offsetX = SwingPlayfieldDrawer.CELL_SIZE; + this.offsetY = SwingPlayfieldDrawer.CELL_SIZE; + } + @Override public Dimension getPreferredSize() { return new Dimension(800, 600);