void KisToolPan::continuePrimaryAction(KoPointerEvent *event) { Q_ASSERT(canvas()); Q_ASSERT(canvas()->canvasController()); QPointF actualPosition = convertDocumentToWidget(e->point); adjustCursor(); if (!e->buttons()) return; e->accept(); if(e->modifiers() & Qt::ShiftModifier) { if(!isInCheckerArea(actualPosition)) { qreal angle = calculateAngle(m_lastPosition, actualPosition); kritaCanvasController()->rotateCanvas(angle); } } else { QPointF distance(m_lastPosition - actualPosition); kritaCanvasController()->pan(distance.toPoint()); } m_lastPosition = actualPosition; }
void KisToolPan::keyPressEvent(QKeyEvent *event) { KoCanvasControllerWidget *canvasControllerWidget = kritaCanvasController(); switch (event->key()) { case Qt::Key_Up: canvasControllerWidget->pan(QPoint(0, -canvasControllerWidget->verticalScrollBar()->singleStep())); break; case Qt::Key_Down: canvasControllerWidget->pan(QPoint(0, canvasControllerWidget->verticalScrollBar()->singleStep())); break; case Qt::Key_Left: canvasControllerWidget->pan(QPoint(-canvasControllerWidget->horizontalScrollBar()->singleStep(), 0)); break; case Qt::Key_Right: canvasControllerWidget->pan(QPoint(canvasControllerWidget->horizontalScrollBar()->singleStep(), 0)); break; case Qt::Key_Shift: m_rotationMode = true; kritaCanvas()->updateCanvas(); adjustCursor(); break; } event->accept(); }
void KisToolPan::endPrimaryAction(KoPointerEvent *event) { Q_UNUSED(e); m_defaultCursor = KisCursor::openHandCursor(); kritaCanvasController()->rotateCanvas(0.0); adjustCursor(); }
void KisToolPan::mouseReleaseEvent(KoPointerEvent *e) { Q_UNUSED(e); m_defaultCursor = KisCursor::openHandCursor(); kritaCanvasController()->rotateCanvas(0.0); adjustCursor(); }
void KisToolPan::beginPrimaryAction(KoPointerEvent *event) { m_lastPosition = convertDocumentToWidget(e->point); e->accept(); m_defaultCursor = KisCursor::closedHandCursor(); adjustCursor(); if(m_rotationMode && isInCheckerArea(m_lastPosition)) { kritaCanvasController()->resetCanvasRotation(); } }
void KisToolPan::mousePressEvent(KoPointerEvent *e) { m_lastPosition = convertDocumentToWidget(e->point); e->accept(); m_defaultCursor = KisCursor::closedHandCursor(); adjustCursor(); if(m_rotationMode && isInCheckerArea(m_lastPosition)) { kritaCanvasController()->resetCanvasTransformations(); } }