// If snapToBottom is enabled, force the scrollbar to the bottom
    void LateUpdate()
    {
        if (screenDimensionsChanged)
        {
            // Update the recycled list view
            if (isLogWindowVisible)
            {
                recycledListView.OnViewportDimensionsChanged();
            }
            else
            {
                popupManager.OnViewportDimensionsChanged();
            }
            screenDimensionsChanged = false;
        }

        if (snapToBottom)
        {
            logItemsScrollRect.verticalNormalizedPosition = 0f;

            if (snapToBottomButton.activeSelf)
            {
                snapToBottomButton.SetActive(false);
            }
        }
        else
        {
            float scrollPos = logItemsScrollRect.verticalNormalizedPosition;
            if (snapToBottomButton.activeSelf != (scrollPos > 1E-6f && scrollPos < 0.9999f))
            {
                snapToBottomButton.SetActive(!snapToBottomButton.activeSelf);
            }
        }

#if !UNITY_EDITOR && UNITY_ANDROID
        if (logcatListener != null)
        {
            string log;
            while ((log = logcatListener.GetLog()) != null)
            {
                ReceivedLog("LOGCAT: " + log, string.Empty, LogType.Log);
            }
        }
#endif
    }
예제 #2
0
    // Debug window is being resized,
    // Set the sizeDelta property of the window accordingly while
    // preventing window dimensions from going below the minimum dimensions
    public void OnWindowResize(BaseEventData dat)
    {
        PointerEventData eventData = (PointerEventData)dat;

        Vector2 newSize = (eventData.position - (Vector2)logWindowTR.position) / canvasTR.localScale.x;

        newSize.y = -newSize.y;
        if (newSize.x < logWindowMinWidth)
        {
            newSize.x = logWindowMinWidth;
        }
        if (newSize.y < logWindowMinHeight)
        {
            newSize.y = logWindowMinHeight;
        }
        logWindowTR.sizeDelta = newSize;

        // Update the recycled list view
        recycledListView.OnViewportDimensionsChanged();
    }