r16823 by jghali - #10041: View -> fit to page width and fit to page height mixed up
scribus-commit
scribus-commit at lists.scribus.net
Thu Sep 8 19:50:55 UTC 2011
Author: jghali
Date: Thu Sep 8 19:50:54 2011
New Revision: 16823
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16823
Log:
#10041: View -> fit to page width and fit to page height mixed up
Modified:
trunk/Scribus/scribus/scribus.cpp
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16823&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Thu Sep 8 19:50:54 2011
@@ -5663,31 +5663,33 @@
{
double finalZoomFactor;
//Zoom to Fit
- if (zoomFactor==-100.0)
- {
- double dx = (view->width()-50) / (doc->currentPage()->width()+30);
- double dy = (view->height()-70) / (doc->currentPage()->height()+30);
- finalZoomFactor = (dx > dy) ? dy : dx;
- }
- else if (zoomFactor==-200.0)
- {
- double dx = (view->width()-50) / (doc->currentPage()->width()+30);
- double dy = (view->height()-70) / (doc->currentPage()->height()+30);
- finalZoomFactor = (dx < dy) ? dy : dx;
+ if (zoomFactor == -100.0)
+ {
+ finalZoomFactor = (view->height()-70) / (doc->currentPage()->height()+30);
+ }
+ else if (zoomFactor == -200.0)
+ {
+ finalZoomFactor = (view->width()-50) / (doc->currentPage()->width()+30);
}
//Zoom to %
else
finalZoomFactor = zoomFactor*prefsManager->displayScale()/100.0;
+
if (finalZoomFactor == view->scale())
return;
+
int x = qRound(qMax(view->contentsX() / view->scale(), 0.0));
int y = qRound(qMax(view->contentsY() / view->scale(), 0.0));
int w = qRound(qMin(view->visibleWidth() / view->scale(), doc->currentPage()->width()));
int h = qRound(qMin(view->visibleHeight() / view->scale(), doc->currentPage()->height()));
- if (zoomFactor==-200.0)
- view->rememberOldZoomLocation(qRound(doc->currentPage()->xOffset() + doc->currentPage()->width() / 2.0), qRound(doc->currentPage()->yOffset() + doc->currentPage()->height() / 2.0));
+
+ if (zoomFactor == -200.0)
+ view->rememberOldZoomLocation(qRound(doc->currentPage()->xOffset() + doc->currentPage()->width() / 2.0), h / 2 + y);
+ else if(zoomFactor == -100.0)
+ view->rememberOldZoomLocation(w / 2 + x, qRound(doc->currentPage()->yOffset() + doc->currentPage()->height() / 2.0));
else
- view->rememberOldZoomLocation(w / 2 + x,h / 2 + y);
+ view->rememberOldZoomLocation(w / 2 + x, h / 2 + y);
+
view->zoom(finalZoomFactor);
}
More information about the scribus-commit
mailing list