Disable text-alignment change when zooming the Web page
I'm currently developing a zooming functionality for a touch-based browser. And I'd like to get some advice on following solution.
When user touches with two fingers on the device the zooming functionality starts to work! For having a little-bit smooth zooming I'm doing following:
Creating a pixmap from the current visible region of web-page using the QWebPage::render()
Creating a QGraphicsView, which shows the Pixmap (using QGraphicsPixmapItem)
When user moves fingers I'm calcuating current scale and the new position of the item
When user releases fingers I'm calcuating a scroll position and zoom factor for the QWebView and setting it on the page (also removing the QGraphicsView which was shown)
I'm doing this as the QWebView::setZoomFactor() works very slow and it is not possible to have smooth zooming with this method.
Now the Question :)
When setting new zoomFactor the page alignment is being changed (e.g. if I zoom-in too much than it starts to cut sentences into rows). I need to have the exact same view without any changed text positions how can I reach it? Any ideas please welcome.
Also please suggest any other (better solution) for smooth zooming.... ;)
You should not use QWebView, and especially not the zoomFactor() for touch based browsing.
We have not had the time to do proper documentation about it but touch-based browsing is quite different from the regular browsing.
For touch-based browsing, you generally use this:
- Frame flattening
- zoom by scaling the QGraphicsWebView
Some more info there:
"http://gitorious.org/light":http://gitorious.org/light : basic browser for touch screen
"http://gitorious.org/yberbrowser":http://gitorious.org/yberbrowser : an interesting browser for the N900
"https://bugs.webkit.org/show_bug.cgi?id=41465":https://bugs.webkit.org/show_bug.cgi?id=41465 the bug report about improving the documentation regarding those feature. A first patch is already available.
Feel free to comment on bugzilla if you have ideas to improve the documentation further. If you have more questions, do not hesitate to ask them here on the forum.