From 38ea171a7c72de3078bb1f07a4c25a2d7f47e9d9 Mon Sep 17 00:00:00 2001 From: Peter Klausing Date: Mon, 4 Mar 2019 09:29:05 +0200 Subject: [PATCH] make zoom flow consistent --- src/control/zoom/ZoomControl.cpp | 34 ++++++++++++++------------------ 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/src/control/zoom/ZoomControl.cpp b/src/control/zoom/ZoomControl.cpp index eea83a08..2d25d7aa 100644 --- a/src/control/zoom/ZoomControl.cpp +++ b/src/control/zoom/ZoomControl.cpp @@ -28,16 +28,17 @@ void ZoomControl::zoomOneStep(bool zoomIn, double x, double y) startZoomSequence(x, y); + this->zoomFitMode = false; + double newZoom; if (zoomIn) { - this->zoom += this->zoomStep; + newZoom = this->zoom + this->zoomStep; } else { - this->zoom -= this->zoomStep; + newZoom = this->zoom - this->zoomStep; } - this->zoomFitMode = false; - fireZoomChanged(); + this->zoomSequnceChange(newZoom, false); endZoomSequence(); } @@ -53,16 +54,17 @@ void ZoomControl::zoomScroll(bool zoomIn, double x, double y) startZoomSequence(x, y); } + this->zoomFitMode = false; + double newZoom; if (zoomIn) { - this->zoom += this->zoomStepScroll; + newZoom = this->zoom + this->zoomStepScroll; } else { - this->zoom -= this->zoomStepScroll; + newZoom = this->zoom - this->zoomStepScroll; } - this->zoomFitMode = false; - fireZoomChanged(); + this->zoomSequnceChange(newZoom, false); } /** @@ -255,8 +257,7 @@ void ZoomControl::setZoomFit(double zoom) if (this->zoomFitMode) { - this->zoom = this->zoomFitValue; - fireZoomChanged(); + zoomFit(); } } @@ -278,12 +279,10 @@ void ZoomControl::zoom100() { XOJ_CHECK_TYPE(ZoomControl); - startZoomSequence(-1, -1); - - this->zoom = this->zoom100Value; this->zoomFitMode = false; - fireZoomChanged(); + startZoomSequence(-1, -1); + this->zoomSequnceChange(this->zoom100Value, false); endZoomSequence(); } @@ -291,12 +290,9 @@ void ZoomControl::zoomFit() { XOJ_CHECK_TYPE(ZoomControl); - startZoomSequence(-1, -1); - - this->zoom = this->zoomFitValue; this->zoomFitMode = true; - fireZoomChanged(); - + startZoomSequence(-1, -1); + this->zoomSequnceChange(this->zoomFitValue, false); endZoomSequence(); }