Example #1
0
void AdvancedImageWidget::zoomChanged()
{
    mUi->zoomInButton ->setEnabled(mUi->expSpinBox->value() != mUi->expSpinBox->maximum());
    mUi->zoomOutButton->setEnabled(mUi->expSpinBox->value() != mUi->expSpinBox->minimum());
    recomputeRects();
    emit notifyZoomChanged(mUi->expSpinBox->value());
    forceUpdate();
}
void ScrollAnimatorNone::zoom(const PlatformGestureEvent& pge)
{
    ASSERT(pge.type() == PlatformGestureEvent::DoubleTapType);
    // FIXME: modify this so we can start even if the timer is active.
    if (!m_animationTimer.isActive()) {
        m_currentZoomScale = 1;
        m_currentZoomTransX = 0;
        m_currentZoomTransY = 0;

        double currentTime = WTF::monotonicallyIncreasingTime();
        float scale = pge.deltaX();

        m_zoomData.m_startTime = currentTime - kTickTime / 2;
        m_zoomData.m_startScale = m_currentZoomScale;
        m_zoomData.m_desiredScale = scale;
        // FIXME: Document then simplify the following equations.
        m_zoomData.m_desiredTransX = (1 - scale) * pge.globalPosition().x();
        m_zoomData.m_desiredTransY = (1 - scale) * pge.globalPosition().y();
#if ENABLE(DOUBLE_TAP_CENTERS)
        if (pge.type() == PlatformGestureEvent::DoubleTapType) {
            // Zoom to centre of display. Pinch-to-zoom may not want this behaviour.
            m_zoomData.m_desiredTransX += m_scrollableArea->visibleWidth() / 2 - pge.globalPosition().x();
            m_zoomData.m_desiredTransY += m_scrollableArea->visibleHeight() / 2 - pge.globalPosition().y();
        }
#endif
        m_zoomData.m_lastAnimationTime = currentTime;
        m_zoomData.m_animationTime = kZoomTicks * kTickTime;

        bool isContinuing = m_zoomData.animateZoom(currentTime);

        double deltaToNextFrame = ceil((currentTime - m_startTime) * kFrameRate) / kFrameRate - (currentTime - m_startTime);
        double nextTimerInterval = max(kMinimumTimerInterval, deltaToNextFrame);
        if (isContinuing) {
            m_animationTimer.startOneShot(nextTimerInterval);
            m_zoomData.m_isAnimating = true;
            notifyZoomChanged(ZoomAnimationContinuing);
        } else
            notifyZoomChanged(ZoomAnimationFinishing);
    }
}
void ScrollAnimatorNone::animationTimerFired(Timer<ScrollAnimatorNone>* timer)
{
#if PLATFORM(CHROMIUM)
    TRACE_EVENT("ScrollAnimatorNone::animationTimerFired", this, 0);
#endif

    double currentTime = WTF::monotonicallyIncreasingTime();
    double deltaToNextFrame = ceil((currentTime - m_startTime) * kFrameRate) / kFrameRate - (currentTime - m_startTime);

    bool continueAnimation = false;
    if (m_horizontalData.m_startTime && m_horizontalData.animateScroll(currentTime + deltaToNextFrame))
        continueAnimation = true;
    if (m_verticalData.m_startTime && m_verticalData.animateScroll(currentTime + deltaToNextFrame))
        continueAnimation = true;

    if (m_zoomData.m_isAnimating) {
#if PLATFORM(CHROMIUM)
        TRACE_EVENT("ScrollAnimatorNone::notifyZoomChanged", this, 0);
#endif
        if (m_zoomData.m_startTime && m_zoomData.animateZoom(currentTime + deltaToNextFrame)) {
            continueAnimation = true;
            notifyZoomChanged(ZoomAnimationContinuing);
        } else {
            notifyZoomChanged(ZoomAnimationFinishing);
            m_zoomData.m_isAnimating = false;
        }
    }

    if (continueAnimation) {
        double nextTimerInterval = max(kMinimumTimerInterval, deltaToNextFrame);
        timer->startOneShot(nextTimerInterval);
    }

#if PLATFORM(CHROMIUM)
    TRACE_EVENT("ScrollAnimatorNone::notifyPositionChanged", this, 0);
#endif
    notifyPositionChanged();
}
Example #4
0
void GameModel::SetZoomFactor(int factor)
{
	ren->ZFACTOR = factor;
	notifyZoomChanged();
}
Example #5
0
void GameModel::SetZoomSize(int size)
{
	ren->zoomScopeSize = size;
	notifyZoomChanged();
}
Example #6
0
void GameModel::SetZoomWindowPosition(ui::Point position)
{
	ren->zoomWindowPosition = position;
	notifyZoomChanged();
}
Example #7
0
void GameModel::SetZoomEnabled(bool enabled)
{
	ren->zoomEnabled = enabled;
	notifyZoomChanged();
}