Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewPlugin.cpp
double TimeViewPlugin::CalcFitScale(double minScale, double maxScale) const
    {
        // get the duration
        double maxTime;
        GetDataTimes(&maxTime, nullptr, nullptr);

        // calculate the right scale to fit it
        double scale = 1.0;
        if (maxTime > 0.0)
        {
            double width    = m_trackDataWidget->geometry().width();
            scale   = (width / m_pixelsPerSecond) / maxTime;
        }

        if (scale < minScale)
        {
            scale = minScale;
        }

        if (scale > maxScale)
        {
            scale = maxScale;
        }

        return scale;
    }
// calculate the scale needed to fit exactly
calculate the scale needed to fit exactly
calculate the scale needed to fit exactly
double TimeViewPlugin::CalcFitScale(double minScale, double maxScale) const
    {
        double maxTime;
        GetDataTimes(&maxTime, nullptr, nullptr);
        double scale = 1.0;
        if (maxTime > 0.0)
        {
            double width    = m_trackDataWidget->geometry().width();
            scale   = (width / m_pixelsPerSecond) / maxTime;
        }
        if (scale < minScale)
        {
            scale = minScale;
        }
        if (scale > maxScale)
        {
            scale = maxScale;
        }
        return scale;
    }
double TimeViewPlugin :: CalcFitScale ( double minScale , double maxScale ) const { double maxTime ; GetDataTimes ( & maxTime , nullptr , nullptr ) ; double scale = 1.0 ; if ( maxTime > 0.0 ) { double width = m_trackDataWidget -> geometry ( ) . width ( ) ; scale = ( width / m_pixelsPerSecond ) / maxTime ; } if ( scale < minScale ) { scale = minScale ; } if ( scale > maxScale ) { scale = maxScale ; } return scale ; }
calculate the scale needed to fit exactly
calculate the scale needed to fit exactly
// get the duration // calculate the right scale to fit it