Example #1
0
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;
}
Example #2
0
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();
}
Example #3
0
void KisToolPan::endPrimaryAction(KoPointerEvent *event)
{
    Q_UNUSED(e);
    m_defaultCursor = KisCursor::openHandCursor();
    kritaCanvasController()->rotateCanvas(0.0);
    adjustCursor();
}
Example #4
0
void KisToolPan::mouseReleaseEvent(KoPointerEvent *e)
{
    Q_UNUSED(e);
    m_defaultCursor = KisCursor::openHandCursor();
    kritaCanvasController()->rotateCanvas(0.0);
    adjustCursor();
}
Example #5
0
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();
    }
}
Example #6
0
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();
    }
}