Commit 9bf9cd4a authored by Sharaf Zaman's avatar Sharaf Zaman Committed by Boudewijn Rempt

Add dedicated action for KisZoomAndRotateAction

Maniphest: T10784
parent 07167cd2
......@@ -68,3 +68,6 @@ version=3
7={7;2;[1000021,20];1;0;0}
8={6;1;[33];0;0;0}
9={8;2;[1000021,1000023,20];1;0;0}
[Zoom and Rotate Canvas]
0={0;4;[];0;0;5}
......@@ -502,11 +502,12 @@ void KisInputManager::Private::addWheelShortcut(KisAbstractInputAction* action,
void KisInputManager::Private::addTouchShortcut(KisAbstractInputAction* action, int index, KisShortcutConfiguration::GestureAction gesture)
{
KisTouchShortcut *shortcut = new KisTouchShortcut(action, index);
KisTouchShortcut *shortcut = new KisTouchShortcut(action, index, gesture);
dbgKrita << "TouchAction:" << action->name();
switch(gesture) {
case KisShortcutConfiguration::RotateGesture:
case KisShortcutConfiguration::PinchGesture:
shortcut = new KisTouchShortcut(new KisZoomAndRotateAction, index);
case KisShortcutConfiguration::ZoomAndRotateGesture:
shortcut->setMinimumTouchPoints(2);
shortcut->setMaximumTouchPoints(2);
break;
......
......@@ -41,6 +41,7 @@
#include "kis_select_layer_action.h"
#include "kis_gamma_exposure_action.h"
#include "kis_change_frame_action.h"
#include "kis_zoom_and_rotate_action.h"
#define PROFILE_VERSION 3
......@@ -369,6 +370,7 @@ void KisInputProfileManager::Private::createActions()
actions.append(new KisSelectLayerAction());
actions.append(new KisGammaExposureAction());
actions.append(new KisChangeFrameAction());
actions.append(new KisZoomAndRotateAction());
}
QString KisInputProfileManager::Private::profileFileName(const QString &profileName)
......
......@@ -71,6 +71,7 @@ public:
PanGesture, ///< Pan gesture, fingers staying together but moving across the screen.
RotateGesture, ///<Rotate gesture, two fingers rotating around a pivot point.
SmartZoomGesture, ///< Smart zoom gesture, typically a double tap that is a boolean zoom/unzoom.
ZoomAndRotateGesture, ///< Zoom and rotate gesture, canvas being both zoomed and rotated using two fingers.
};
/**
......
......@@ -19,20 +19,27 @@
*/
#include "kis_touch_shortcut.h"
#include "kis_abstract_input_action.h"
#include <QTouchEvent>
class KisTouchShortcut::Private
{
public:
Private() : minTouchPoints(0), maxTouchPoints(0) { }
Private(GestureAction type)
: minTouchPoints(0)
, maxTouchPoints(0)
, type(type)
{ }
int minTouchPoints;
int maxTouchPoints;
GestureAction type;
};
KisTouchShortcut::KisTouchShortcut( KisAbstractInputAction* action, int index )
: KisAbstractShortcut(action, index), d( new Private )
KisTouchShortcut::KisTouchShortcut(KisAbstractInputAction* action, int index, GestureAction type)
: KisAbstractShortcut(action, index)
, d(new Private(type))
{
}
......
......@@ -22,6 +22,7 @@
#define KISTOUCHSHORTCUT_H
#include "kis_abstract_shortcut.h"
#include "kis_shortcut_configuration.h"
class QTouchEvent;
/**
......@@ -31,8 +32,10 @@ class QTouchEvent;
*/
class KisTouchShortcut : public KisAbstractShortcut
{
using GestureAction = KisShortcutConfiguration::GestureAction;
public:
KisTouchShortcut( KisAbstractInputAction* action, int index );
KisTouchShortcut(KisAbstractInputAction* action, int index, GestureAction type);
~KisTouchShortcut() override;
int priority() const override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment