23 #include <pointerevent.h>
26 #include "layercamera.h"
28 #include "strokemanager.h"
29 #include "viewmanager.h"
30 #include "scribblearea.h"
37 void HandTool::loadSettings()
39 properties.width = -1;
40 properties.feather = -1;
41 properties.useFeather =
false;
42 properties.stabilizerLevel = -1;
43 properties.useAA = -1;
53 mLastPixel = getCurrentPixel();
54 mStartPoint = mEditor->view()->mapScreenToCanvas(mLastPixel);
57 mScribbleArea->updateToolCursor();
67 transformView(event->
modifiers(),
event->buttons());
68 mLastPixel = getCurrentPixel();
76 qDebug(
"[HandTool] Stop Hand Tool");
77 mScribbleArea->setPrevTool();
80 mScribbleArea->updateToolCursor();
83 void HandTool::pointerDoubleClickEvent(
PointerEvent* event)
87 mEditor->view()->resetView();
101 QPointF d = getCurrentPoint() - getLastPoint();
102 QPointF offset = viewMgr->translation() + d;
103 viewMgr->translate(offset);
108 QVector2D startV(getLastPixel() - centralPixel);
109 QVector2D curV(getCurrentPixel() - centralPixel);
111 qreal angleOffset =
static_cast<qreal
>(std::atan2(curV.y(), curV.x()) - std::atan2(startV.y(), startV.x()));
112 angleOffset = qRadiansToDegrees(angleOffset);
113 float newAngle = viewMgr->rotation() +
static_cast<float>(angleOffset);
114 viewMgr->rotate(newAngle);
118 float delta = (
static_cast<float>(getCurrentPixel().
y() - mLastPixel.
y())) / 100.f;
119 qreal scaleValue = viewMgr->scaling() * (1 + delta);
120 viewMgr->scaleWithOffset(scaleValue, mStartPoint);
typedef KeyboardModifiers
Qt::KeyboardModifiers modifiers() const
Returns the modifier created by keyboard while a device was in use.
Qt::MouseButtons buttons() const
Returns Qt::MouseButtons()
Qt::MouseButton button() const
Returns Qt::MouseButton()