1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Implemented zoom reset shortcut (backspace)

This commit is contained in:
Ivan Savenko
2023-05-17 14:54:19 +03:00
parent 7504ceb256
commit 872b68c59a
4 changed files with 5 additions and 1 deletions

View File

@ -91,7 +91,7 @@ void MapViewController::modifyTileSize(int stepsChange)
// try to determine current zooming level and change it by requested number of steps
double currentZoomFactor = model->getSingleTileSize().x / 32.0;
double currentZoomSteps = std::round(std::log(currentZoomFactor) / std::log(1.1));
double newZoomSteps = currentZoomSteps + stepsChange;
double newZoomSteps = stepsChange != 0 ? currentZoomSteps + stepsChange : stepsChange;
double newZoomFactor = std::pow(1.1, newZoomSteps);
Point currentZoom = model->getSingleTileSize();