mirror of
https://github.com/YACReader/yacreader
synced 2025-07-21 22:44:56 -04:00
Add bare metal zoom handling to viewer
This commit is contained in:
@ -38,7 +38,8 @@ restoreMagnifyingGlass(false),
|
|||||||
drag(false),
|
drag(false),
|
||||||
numScrollSteps(22),
|
numScrollSteps(22),
|
||||||
shouldOpenNext(false),
|
shouldOpenNext(false),
|
||||||
shouldOpenPrevious(false)
|
shouldOpenPrevious(false),
|
||||||
|
zoom(1)
|
||||||
{
|
{
|
||||||
translator = new YACReaderTranslator(this);
|
translator = new YACReaderTranslator(this);
|
||||||
translator->hide();
|
translator->hide();
|
||||||
@ -350,16 +351,21 @@ void Viewer::updateContentSize()
|
|||||||
pagefit.scale(size(), Qt::KeepAspectRatio);
|
pagefit.scale(size(), Qt::KeepAspectRatio);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//apply scaling
|
|
||||||
content->resize(pagefit);
|
|
||||||
|
|
||||||
//TODO: updtateContentSize should only scale the pixmap once
|
if(zoom != 1)
|
||||||
if(devicePixelRatio()>1)//only in retina display
|
{
|
||||||
{
|
pagefit.scale(pagefit.width()*zoom, 0, Qt::KeepAspectRatioByExpanding);
|
||||||
QPixmap page = currentPage->scaled(content->width()*devicePixelRatio(), content->height()*devicePixelRatio(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
}
|
||||||
page.setDevicePixelRatio(devicePixelRatio());
|
//apply scaling
|
||||||
content->setPixmap(page);
|
content->resize(pagefit);
|
||||||
}
|
|
||||||
|
//TODO: updtateContentSize should only scale the pixmap once
|
||||||
|
if(devicePixelRatio()>1)//only in retina display
|
||||||
|
{
|
||||||
|
QPixmap page = currentPage->scaled(content->width()*devicePixelRatio(), content->height()*devicePixelRatio(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
|
page.setDevicePixelRatio(devicePixelRatio());
|
||||||
|
content->setPixmap(page);
|
||||||
|
}
|
||||||
|
|
||||||
emit backgroundChanges();
|
emit backgroundChanges();
|
||||||
}
|
}
|
||||||
|
@ -96,6 +96,9 @@ virtual void mouseReleaseEvent ( QMouseEvent * event );
|
|||||||
bool information;
|
bool information;
|
||||||
bool doublePage;
|
bool doublePage;
|
||||||
bool doubleMangaPage;
|
bool doubleMangaPage;
|
||||||
|
|
||||||
|
qreal zoom;
|
||||||
|
|
||||||
PageLabelWidget * informationLabel;
|
PageLabelWidget * informationLabel;
|
||||||
//QTimer * scroller;
|
//QTimer * scroller;
|
||||||
QPropertyAnimation * verticalScroller;
|
QPropertyAnimation * verticalScroller;
|
||||||
|
Reference in New Issue
Block a user