mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-15 00:05:02 +02:00
save mapzoom
This commit is contained in:
@ -72,7 +72,7 @@ void MapViewController::setViewCenter(const Point & position, int level)
|
||||
adventureInt->onMapViewMoved(model->getTilesTotalRect(), model->getLevel());
|
||||
}
|
||||
|
||||
void MapViewController::setTileSize(const Point & tileSize)
|
||||
void MapViewController::setTileSize(const Point & tileSize, bool setTarget)
|
||||
{
|
||||
Point oldSize = model->getSingleTileSize();
|
||||
model->setTileSize(tileSize);
|
||||
@ -87,6 +87,9 @@ void MapViewController::setTileSize(const Point & tileSize)
|
||||
|
||||
// force update of view center since changing tile size may invalidated it
|
||||
setViewCenter(newViewCenter, model->getLevel());
|
||||
|
||||
if(setTarget)
|
||||
targetTileSize = tileSize;
|
||||
}
|
||||
|
||||
void MapViewController::modifyTileSize(int stepsChange, bool useDeadZone)
|
||||
@ -125,7 +128,7 @@ void MapViewController::modifyTileSize(int stepsChange, bool useDeadZone)
|
||||
if(actualZoom.y >= defaultTileSize - zoomTileDeadArea && actualZoom.y <= defaultTileSize + zoomTileDeadArea)
|
||||
actualZoom.y = defaultTileSize;
|
||||
}
|
||||
|
||||
|
||||
bool isInDeadZone = targetTileSize != actualZoom || actualZoom == Point(defaultTileSize, defaultTileSize);
|
||||
|
||||
if(!wasInDeadZone && isInDeadZone)
|
||||
@ -133,7 +136,10 @@ void MapViewController::modifyTileSize(int stepsChange, bool useDeadZone)
|
||||
|
||||
wasInDeadZone = isInDeadZone;
|
||||
|
||||
setTileSize(actualZoom);
|
||||
setTileSize(actualZoom, false);
|
||||
|
||||
Settings tileZoom = persistentStorage.write["tileZoom"];
|
||||
tileZoom->Integer() = actualZoom.x;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user