Only adjust reading positon during orientation switch.
[dorian] / bookview.cpp
index c3b3166..3964afa 100644 (file)
@@ -517,9 +517,15 @@ void BookView::onMediaKeysPressed(MediaKeysObserver::MediaKeys key)
 
 #endif // Q_OS_SYMBIAN
 
+#ifdef Q_OS_SYMBIAN
+
 void BookView::adjustPosition()
 {
     TRACE;
+
+    // QWebView widget doesn't maintain reading positon during orientation
+    // switch. This heuristics tries to work around it.
+
     const qreal portraitMagic = 1.66;
     const qreal landscapeMagic = 0.655;
     if (mBook) {
@@ -529,7 +535,8 @@ void BookView::adjustPosition()
         qreal ratio = (screenWidth<screenHeight)? portraitMagic: landscapeMagic;
         QWebFrame *frame = page()->mainFrame();
         int current = frame->scrollPosition().y();
-        qDebug() << "From" << current << "to" << (int)(current * ratio);
         frame->scroll(0, (int)(current * ratio) - current);
     }
 }
+
+#endif // Q_OS_SYMBIAN