#endif // Q_OS_SYMBIAN
-void BookView::adjustPosition(const QSize &size, const QSize &oldSize)
+void BookView::adjustPosition()
{
+ TRACE;
+ const qreal portraitMagic = 1.66;
+ const qreal landscapeMagic = 0.655;
if (mBook) {
+ QSize desktop = QApplication::desktop()->size();
+ int screenHeight = desktop.height();
+ int screenWidth = desktop.width();
+ qreal ratio = (screenWidth<screenHeight)? portraitMagic: landscapeMagic;
QWebFrame *frame = page()->mainFrame();
- int height = frame->contentsSize().height();
- int pos = frame->scrollPosition().y();
- qDebug() << QString("At %1 (%2%, height %3)").
- arg(pos).arg((qreal)pos / (qreal)height * 100).arg(height);
+ int current = frame->scrollPosition().y();
+ qDebug() << "From" << current << "to" << (int)(current * ratio);
+ frame->scroll(0, (int)(current * ratio) - current);
}
}