kalgebra
Go to the documentation of this file.
2 import org.kde.analitza 1.0
12 property double thePreviousScale: 1
18 function distance(p1, p2)
22 return Math.sqrt(w*w+h*h)
25 onPinchStarted: thePreviousScale=1
28 var currentDistance = distance(pinch.point1, pinch.point2)
29 if(currentDistance>0) {
30 var startDistance = distance(pinch.startPoint1, pinch.startPoint2)
32 var theCurrentScale = startDistance/currentDistance
34 var doScale = theCurrentScale/thePreviousScale
35 view.scale(doScale, view.width/2, view.height/2)
37 thePreviousScale = theCurrentScale
46 acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
48 onPressed: { lastX=mouse.x; lastY=mouse.y }
51 view.translate(mouse.x-lastX, mouse.y-lastY)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:11:49 by
doxygen 1.8.7 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.