Commit 8b8fbde3 authored by Aleksei Kanash's avatar Aleksei Kanash

SANKORE-343. Maximum zoom was limited to 9.

parent 5ebe2921
...@@ -687,9 +687,16 @@ void UBBoardController::zoom(const qreal ratio, QPointF scenePoint) ...@@ -687,9 +687,16 @@ void UBBoardController::zoom(const qreal ratio, QPointF scenePoint)
QPointF offset = scenePoint - viewCenter; QPointF offset = scenePoint - viewCenter;
QPointF scalledOffset = offset / ratio; QPointF scalledOffset = offset / ratio;
mControlView->scale(ratio, ratio); qreal currentZoom = ratio * mControlView->viewportTransform().m11() / mSystemScaleFactor;
qreal currentZoom = mControlView->viewportTransform().m11() / mSystemScaleFactor; qreal usedRatio = ratio;
if (currentZoom > UB_MAX_ZOOM)
{
currentZoom = UB_MAX_ZOOM;
usedRatio = currentZoom * mSystemScaleFactor / mControlView->viewportTransform().m11();
}
mControlView->scale(usedRatio, usedRatio);
QPointF newCenter = scenePoint - scalledOffset; QPointF newCenter = scenePoint - scalledOffset;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <QtGui> #include <QtGui>
#define UB_MAX_ZOOM 15 #define UB_MAX_ZOOM 9
struct UBMimeType struct UBMimeType
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment