mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-15 00:05:02 +02:00
Fix zooming with keyboard shortcuts
This commit is contained in:
@ -88,7 +88,7 @@ void MapViewController::setTileSize(const Point & tileSize)
|
||||
setViewCenter(newViewCenter, model->getLevel());
|
||||
}
|
||||
|
||||
void MapViewController::modifyTileSize(int stepsChange)
|
||||
void MapViewController::modifyTileSize(int stepsChange, bool useDeadZone)
|
||||
{
|
||||
// we want to zoom in/out in fixed 10% steps, to allow player to return back to exactly 100% zoom just by scrolling
|
||||
// so, zooming in for 5 steps will put game at 1.1^5 = 1.61 scale
|
||||
@ -117,10 +117,13 @@ void MapViewController::modifyTileSize(int stepsChange)
|
||||
if (actualZoom != currentZoom)
|
||||
{
|
||||
targetTileSize = actualZoom;
|
||||
if(actualZoom.x >= defaultTileSize - zoomTileDeadArea && actualZoom.x <= defaultTileSize + zoomTileDeadArea)
|
||||
actualZoom.x = defaultTileSize;
|
||||
if(actualZoom.y >= defaultTileSize - zoomTileDeadArea && actualZoom.y <= defaultTileSize + zoomTileDeadArea)
|
||||
actualZoom.y = defaultTileSize;
|
||||
if (useDeadZone)
|
||||
{
|
||||
if(actualZoom.x >= defaultTileSize - zoomTileDeadArea && actualZoom.x <= defaultTileSize + zoomTileDeadArea)
|
||||
actualZoom.x = defaultTileSize;
|
||||
if(actualZoom.y >= defaultTileSize - zoomTileDeadArea && actualZoom.y <= defaultTileSize + zoomTileDeadArea)
|
||||
actualZoom.y = defaultTileSize;
|
||||
}
|
||||
|
||||
bool isInDeadZone = targetTileSize != actualZoom || actualZoom == Point(defaultTileSize, defaultTileSize);
|
||||
|
||||
|
Reference in New Issue
Block a user