我只是在寻找一种方法来“增量缩放” Qt / Qml中的图像。这意味着
跳转的原因是,在当前Center.x / y上,缩放始终以Scaling = 1开头。我需要“缩放”,因为我使用了一个大的Frambuffer对象,Flickable
导致了新的计算,并使一切变得非常缓慢。
import QtQuick 2.6
Rectangle {
id: iTImag
state: "start"
anchors.fill: parent
color: "#343434"
Image {
id: iImage
width: parent.width
height: parent.height
source: Imag.url
sourceSize.width: width
fillMode: Image.PreserveAspectFit
transform:
Scale {
id: iScale
}
}
PinchArea {
id: iPinchArea
anchors.fill: parent
pinch.minimumScale: 1
pinch.maximumScale: 8
property real mScale: 1
onPinchStarted: {
iScale.xScale = mScale;
iScale.yScale = mScale;
}
onPinchUpdated: {
console.log("onPinchUpdated");
iScale.origin.x = pinch.center.x;
iScale.origin.y = pinch.center.y;
mScale += pinch.scale - pinch.previousScale;
iScale.xScale = mScale;
iScale.yScale = mScale;
}
}
也许有人有主意吗?