metalpriest94 / The_Old_Days

Development of a tile-based strategy-game. Formerly named 'GridBoard'.
0 stars 0 forks source link

Fix Zoom's behaviour #1

Closed metalpriest94 closed 8 years ago

metalpriest94 commented 8 years ago

What to do: On zoom, panelGame is supposed to keep track of the tile in the middle.

Currently, the code for zooming in/out causes panelGame to jump around in a weird way. Removing this would cause panelGame to keep track of the tile in the upper-left corner.

public void zoomIn()
    {
        if (zoomLevel < 8)
        {

            for(int i =0; i < (panelGame.getWidth() / panelGame.getTileSize() / 4); i++)
            {
                moveRight();
                moveDown();
            }
            changeZoom(+1);
        }
    }

    public void zoomOut()
    {
        if (zoomLevel > 1)
        {
            changeZoom(-1);
            for(int i =0; i < (panelGame.getWidth() / panelGame.getTileSize() / 4); i++)
            {
                System.out.println(i);
                moveLeft();
                moveUp();
            }
        }
    }
metalpriest94 commented 8 years ago

Zooming in panelGame now shows the desired behaviour.