28{
29 QNativeGestureEvent *gevent = static_cast<QNativeGestureEvent *>(event);
30 if (gevent->gestureType() == Qt::SmartZoomNativeGesture) {
32
35 } else {
37 }
38 }
else if (gevent->gestureType() == Qt::ZoomNativeGesture &&
flags().testFlag(
ZoomEnabled)) {
41
42 const qreal delta = 1.0 + gevent->value();
43
44
45
46 if (qAbs(delta) > 1.2 || qAbs(delta) < 0.8) {
47
48 return;
49 }
50
52
54 if (delta > 1.0) {
55 const qreal nextExpectedZoom =
57 if (newZoom >= nextExpectedZoom) {
59 }
60 } else if (delta < 1.0) {
61 const qreal prevExpectedZoom =
63 if (newZoom <= prevExpectedZoom) {
65 }
66 }
67
68 } else {
70 }
71
73
74 }
else if (gevent->gestureType() == Qt::RotateNativeGesture &&
flags().testFlag(
RotationEnabled)) {
76
78
79 const qreal rotationAngle = [&]() {
83 } else {
87 }
88 }();
89
92 }
93 }
94 if (gevent->gestureType() == Qt::PanNativeGesture &&
flags().testFlag(
PanEnabled)) {
95#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
97
99
100
101
102
106
107
108
110 controller->
pan(-canvasOffset);
111#endif
112 }
113}
void rotateCanvas(qreal angle, const std::optional< KoViewTransformStillPoint > &stillPoint, bool isNativeGesture=false)
qreal m_nonRoundedRelativeRotation
SnappedRotationData m_rotationData
static qreal canvasRotationAngleContinuous(qreal currentRotationOffset, qreal currectCanvasRotation, SnappedRotationData &data)
static qreal canvasRotationAngleDescrete(qreal currentRotationOffset, SnappedRotationData &data)
static qreal findNextZoom(qreal currentZoom, const QVector< qreal > &zoomLevels)
qreal clampZoom(qreal zoom) const
QVector< qreal > standardZoomLevels() const
static qreal findPrevZoom(qreal currentZoom, const QVector< qreal > &zoomLevels)
KoCanvasController * canvasController() const
virtual KoZoomState zoomState() const =0
virtual void setZoom(KoZoomMode::Mode mode, qreal zoom)=0
void zoom(qreal *zoomX, qreal *zoomY) const override
@ ZOOM_WIDTH
zoom pagewidth
static bool qFuzzyIsNull(half h)
T kisDegreesToRadians(T degrees)