Пример #1
0
void QtViewportHandler::pageItemPositionChanged()
{
    QPointF newPosition = m_viewportItem->contentPos();

    informVisibleContentChange(m_lastScrollPosition - newPosition);

    m_lastScrollPosition = newPosition;
}
void QtViewportInteractionEngine::flickableMovingPositionUpdate()
{
    QPointF newPosition = m_viewport->contentPos();

    emit informVisibleContentChange(m_lastScrollPosition - newPosition);

    m_lastScrollPosition = newPosition;
}
Пример #3
0
void QtViewportHandler::viewportItemSizeChanged()
{
    QSize viewportSize = m_viewportItem->boundingRect().size().toSize();

    if (viewportSize.isEmpty())
        return;

    // Let the WebProcess know about the new viewport size, so that
    // it can resize the content accordingly.
    m_webPageProxy->setViewportSize(viewportSize);

    informVisibleContentChange(QPointF());
}
void QtViewportInteractionEngine::pagePositionRequest(const QPoint& pagePosition)
{
    // Ignore the request if suspended. Can only happen due to delay in event delivery.
    if (m_suspendCount)
        return;

    qreal endItemScale = m_content->contentsScale(); // Stay at same scale.

    QRectF endPosRange = computePosRangeForItemAtScale(endItemScale);
    QPointF endPosition = boundPosition(endPosRange.topLeft(), pagePosition * endItemScale, endPosRange.bottomRight());

    QRectF endVisibleContentRect(endPosition / endItemScale, m_viewport->boundingRect().size() / endItemScale);

    setItemRectVisible(endVisibleContentRect);

    // Make sure that tiles all around the viewport will be requested.
    emit informVisibleContentChange(QPointF());
}
void QtViewportInteractionEngine::pinchGestureStarted(const QPointF& pinchCenterInViewportCoordinates)
{
    // This can only happen as a result of a user interaction.
    ASSERT(m_hadUserInteraction);

    if (!m_allowsUserScaling)
        return;

    m_scaleStack.clear();
    m_zoomOutScale = 0.0;

    m_scaleUpdateDeferrer = adoptPtr(new ViewportUpdateDeferrer(this, ViewportUpdateDeferrer::DeferUpdateAndSuspendContent));

    m_lastPinchCenterInViewportCoordinates = pinchCenterInViewportCoordinates;
    m_pinchStartScale = m_content->contentsScale();

    // Reset the tiling look-ahead vector so that tiles all around the viewport will be requested on pinch-end.
    emit informVisibleContentChange(QPointF());
}