diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-08-31 08:33:17 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-08-31 08:33:17 (GMT) |
commit | 6c01a596f9b2bf51add0a3f69faf15435f041b4f (patch) | |
tree | d8079267737f49ad3fd4390af90bf50520b30911 /demos/declarative/webbrowser | |
parent | 0c6dfd680fa1e970c6bbb425cf05c9d42d70fe6f (diff) | |
download | Qt-6c01a596f9b2bf51add0a3f69faf15435f041b4f.zip Qt-6c01a596f9b2bf51add0a3f69faf15435f041b4f.tar.gz Qt-6c01a596f9b2bf51add0a3f69faf15435f041b4f.tar.bz2 |
Revive animated zooming.
Now uses scale for transition while static uses zoomFactor.
QFxPaintedItem assists by being able to freeze the cache - useful anywhere
that dirty cache data is okay to use (i.e. during brief animations).
Diffstat (limited to 'demos/declarative/webbrowser')
-rw-r--r-- | demos/declarative/webbrowser/webbrowser.qml | 68 |
1 files changed, 65 insertions, 3 deletions
diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml index 2cd9f57..4c4ad7c 100644 --- a/demos/declarative/webbrowser/webbrowser.qml +++ b/demos/declarative/webbrowser/webbrowser.qml @@ -190,7 +190,7 @@ Item { } url: fixUrl(WebBrowser.urlString) - smooth: !Flick.moving + smooth: false fillColor: "white" focus: true @@ -200,9 +200,71 @@ Item { onUrlChanged: { if (url != null) { WebBrowser.urlString = url.toString(); } } onDoubleClick: { heuristicZoom(clickX,clickY) } - onZooming: { Flick.viewportX=Math.min(MyWebView.width-Flick.width,Math.max(0,centerX-Flick.width/2)); - Flick.viewportY=Math.max(0,Math.min(MyWebView.height-Flick.height,centerY-Flick.height/2)) } + SequentialAnimation { + id: QuickZoom + PropertyAction { + target: MyWebView + property: "renderingEnabled" + value: false + } + ParallelAnimation { + NumberAnimation { + id: ScaleAnim + target: MyWebView + property: "scale" + from: 1 + to: 0 // set before calling + easing: "easeInOutQuad" + duration: 200 + } + NumberAnimation { + id: FlickVX + target: Flick + property: "viewportX" + easing: "easeInOutQuad" + duration: 200 + from: 0 // set before calling + to: 0 // set before calling + } + NumberAnimation { + id: FlickVY + target: Flick + property: "viewportY" + easing: "easeInOutQuad" + duration: 200 + from: 0 // set before calling + to: 0 // set before calling + } + } + PropertyAction { + target: MyWebView + property: "scale" + value: 1.0 + } + PropertyAction { + id: FinalZoom + target: MyWebView + property: "zoomFactor" + } + PropertyAction { + target: MyWebView + property: "renderingEnabled" + value: true + } + } + onZooming: { + if (centerX) { + sc = zoom/zoomFactor; + ScaleAnim.to = sc; + FlickVX.from = Flick.viewportX + FlickVX.to = Math.min(Math.max(0,centerX-Flick.width/2),MyWebView.width*sc-Flick.width) + FlickVY.from = Flick.viewportY + FlickVY.to = Math.min(Math.max(0,centerY-Flick.height/2),MyWebView.height*sc-Flick.height) + FinalZoom.value = zoom + QuickZoom.start() + } + } } Rectangle { id: WebViewTint |