void QtViewportInteractionEngine::itemSizeChanged() { // FIXME: This needs to be done smarter. What happens if it resizes when we were interacting? if (m_suspendCount) return; ViewportUpdateDeferrer guard(this); ensureContentWithinViewportBoundary(true); }
void QtViewportInteractionEngine::cancelScrollAnimation() { ViewportUpdateDeferrer guard(this); // If the pan gesture recognizer receives a touch begin event // during an ongoing kinetic scroll animation of a previous // pan gesture, the animation is stopped and the content is // immediately positioned back to valid boundaries. m_viewport->cancelFlick(); ensureContentWithinViewportBoundary(/*immediate*/ true); }
void QtViewportInteractionEngine::pinchGestureEnded() { ASSERT(m_suspendCount); if (!m_allowsUserScaling) return; m_pinchStartScale = -1; // Clear the update deferrer now if we're in our final position and there won't be any animation to clear it later. if (ensureContentWithinViewportBoundary()) m_scaleUpdateDeferrer.clear(); }
void QtViewportInteractionEngine::applyConstraints(const Constraints& constraints) { // We always have to apply the constrains even if they didn't change, as // the initial scale might need to be applied. ViewportUpdateDeferrer guard(this); m_constraints = constraints; if (!m_hadUserInteraction) { qreal initialScale = innerBoundedCSSScale(m_constraints.initialScale); m_content->setContentsScale(itemScaleFromCSS(initialScale)); } // If the web app changes successively changes the viewport on purpose // it wants to be in control and we should disable animations. ensureContentWithinViewportBoundary(/* immediate */ true); }