enter code here
PinchArea
{
MouseArea
{
id:dragArea
hoverEnabled: true
anchors.fill: parent
drag.target: image
scrollGestureEnabled: false
// drag.maximumX: Screen.width
// drag.maximumY: Screen.height
}
anchors.fill:image
enabled: true
pinch.target: image
pinch.maximumScale: 4.0
pinch.minimumScale: 1.0
pinch.dragAxis: pinch.XAndYAxis
pinch.maximumX: image.width
pinch.maximumY: image.heighr
onPinchStarted: {
console.log("console ","pinchstarted")
}
onPinchUpdated: {
console.log("console ","pinchUpdated")
}
onPinchFinished: {
console.log("console ","pinchfinished")
}
}
}
我想在捏时将缩放比例增加或减少0.1。而且,当您获取日志时,会生成太多onPinchUpdated。我要在每次捏合时记录1步。
您需要删除pinch.target: image
,而是根据对onPinchStarted和onPinchUpdated处理程序中可访问的image
值进行四舍五入来手动设置pinch.scale
的比例。