Assets/SpeechToText/Scripts/SpeechToTextWidgets/SpeechToTextServiceWidget.cs
/// <summary>
/// Resizes the scroll view content rectangle so that it can fit the results text.
/// </summary>
Resizes the scroll view content rectangle so that it can fit the results text.
Resizes the scroll view content rectangle so that it can fit the results text .
void FitScrollViewContentToText()
        {
            float textHeight = LayoutUtility.GetPreferredHeight(m_ResultsTextUI.rectTransform);
            float parentHeight = m_ScrollViewContentRect.rect.height;
            if (textHeight + m_VerticalTextPadding >= parentHeight)
            {
                m_ScrollViewContentRect.offsetMin = new Vector2(m_ScrollViewContentRect.offsetMin.x, m_ScrollViewContentRect.offsetMin.y - m_TextLineHeight);
                m_ResultsScrollRect.verticalNormalizedPosition = 0;
            }
            else if (textHeight + m_VerticalTextPadding < parentHeight - m_TextLineHeight && parentHeight - m_TextLineHeight >= m_MinScrollViewContentHeight)
            {
                m_ScrollViewContentRect.offsetMin = new Vector2(m_ScrollViewContentRect.offsetMin.x, m_ScrollViewContentRect.offsetMin.y + m_TextLineHeight);
                m_ResultsScrollRect.verticalNormalizedPosition = 0;
            }
        }
void FitScrollViewContentToText ( ) { float textHeight = LayoutUtility . GetPreferredHeight ( m_ResultsTextUI . rectTransform ) ; float parentHeight = m_ScrollViewContentRect . rect . height ; if ( textHeight + m_VerticalTextPadding >= parentHeight ) { m_ScrollViewContentRect . offsetMin = new Vector2 ( m_ScrollViewContentRect . offsetMin . x , m_ScrollViewContentRect . offsetMin . y - m_TextLineHeight ) ; m_ResultsScrollRect . verticalNormalizedPosition = 0 ; } else if ( textHeight + m_VerticalTextPadding < parentHeight - m_TextLineHeight && parentHeight - m_TextLineHeight >= m_MinScrollViewContentHeight ) { m_ScrollViewContentRect . offsetMin = new Vector2 ( m_ScrollViewContentRect . offsetMin . x , m_ScrollViewContentRect . offsetMin . y + m_TextLineHeight ) ; m_ResultsScrollRect . verticalNormalizedPosition = 0 ; } }
Resizes the scroll view content rectangle so that it can fit the results text.
Resizes the scroll view content rectangle so that it can fit the results text .