[SOLVED]Qt Quick and QML Image Zoom
-
wrote on 4 Jul 2013, 08:08 last edited by
Hi there !
I've got a problem on moving on my image when i zoom on it.
Basically, i scale the image to reproduce a zoom.
What i'm doing now is translating the image.
@ property int transformX:0;
property int transformY:0;Rectangle
{
id:borderEmulation;
color: "lightgray";
clip: trueanchors { fill: parent; margins: 2; } Image { id: visibleImg; source: "qrc:/visible"; antialiasing: true; fillMode: Image.PreserveAspectFit; //transformOrigin: Item.Center; transform: Translate { y: transformY*visibleImg.scale; x: transformX*visibleImg.scale } anchors { fill:parent; bottomMargin: myProgressBar.height+10; margins: 2; } }
}@
And 4 button that increase / deacrease by 20 the transform(X/Y).
My point is : is here a way to know when i'm zooming out of my picture ?
ie. when i have to stop my translation because the right/left/top/bottom end of the image is displayed ?
Regards
-
wrote on 4 Jul 2013, 12:44 last edited by
Solved by :
@
MouseArea
{
anchors.fill: parent;
onClicked:
{
if(transformY > -((visibleImg.height/2 - (visibleImg.height-visibleImg.paintedHeight)/2)(visibleImg.scale-1)) + visibleImg.scale10)
transformY -= visibleImg.scale10;
else
transformY = -(visibleImg.height/2 - (visibleImg.height-visibleImg.paintedHeight)/2)(visibleImg.scale-1);
}
}
@Resp. with +/- and X/Y on the appropriate directions.
1/2