diff options
Diffstat (limited to 'demos/declarative/flickr/common/ImageDetails.qml')
-rw-r--r-- | demos/declarative/flickr/common/ImageDetails.qml | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/demos/declarative/flickr/common/ImageDetails.qml b/demos/declarative/flickr/common/ImageDetails.qml index ab94d7a..9604f10 100644 --- a/demos/declarative/flickr/common/ImageDetails.qml +++ b/demos/declarative/flickr/common/ImageDetails.qml @@ -50,7 +50,7 @@ Flipable { LikeOMeter { x: 40; y: 250; rating: container.rating } Flickable { id: flickable; x: 220; width: 480; height: 210; y: 130; clip: true - viewportWidth: 480; viewportHeight: descriptionText.height + contentWidth: 480; contentHeight: descriptionText.height WebView { id: descriptionText; width: parent.width html: "<style TYPE=\"text/css\">body {color: white;} a:link {color: cyan; text-decoration: underline; }</style>" + container.photoDescription } @@ -84,7 +84,7 @@ Flipable { Flickable { id: flick; width: container.width - 10; height: container.height - 10 x: 5; y: 5; clip: true; - viewportWidth: imageContainer.width; viewportHeight: imageContainer.height + contentWidth: imageContainer.width; contentHeight: imageContainer.height Item { id: imageContainer @@ -93,9 +93,7 @@ Flipable { Image { id: bigImage; source: container.photoUrl; scale: slider.value - // Center image if it is smaller than the flickable area. - x: imageContainer.width > width*scale ? (imageContainer.width - width*scale) / 2 : 0 - y: imageContainer.height > height*scale ? (imageContainer.height - height*scale) / 2 : 0 + anchors.centerIn: parent; smooth: !flick.moving onStatusChanged : { // Default scale shows the entire image. @@ -122,12 +120,12 @@ Flipable { id: slider; x: 25; y: 374; visible: { bigImage.status == 1 && maximum > minimum } onValueChanged: { if (bigImage.width * value > flick.width) { - var xoff = (flick.width/2 + flick.viewportX) * value / prevScale; - flick.viewportX = xoff - flick.width/2; + var xoff = (flick.width/2 + flick.contentX) * value / prevScale; + flick.contentX = xoff - flick.width/2; } if (bigImage.height * value > flick.height) { - var yoff = (flick.height/2 + flick.viewportY) * value / prevScale; - flick.viewportY = yoff - flick.height/2; + var yoff = (flick.height/2 + flick.contentY) * value / prevScale; + flick.contentY = yoff - flick.height/2; } prevScale = value; } |