PDFViewerLeftPanelScrollbar.cs 795 B

123456789101112131415161718192021222324252627282930
  1. using UnityEngine;
  2. using UnityEngine.EventSystems;
  3. using UnityEngine.UI;
  4. namespace Paroxe.PdfRenderer.Internal.Viewer
  5. {
  6. public class PDFViewerLeftPanelScrollbar : UIBehaviour
  7. {
  8. private CanvasGroup m_CanvasGroup;
  9. private Scrollbar m_Scrollbar;
  10. void LateUpdate()
  11. {
  12. if (m_Scrollbar.size >= 0.98f && m_CanvasGroup.alpha != 0.0f)
  13. {
  14. m_CanvasGroup.alpha = 0.0f;
  15. }
  16. else if (m_Scrollbar.size < 0.98f && m_CanvasGroup.alpha != 1.0f)
  17. {
  18. m_CanvasGroup.alpha = 1.0f;
  19. }
  20. }
  21. protected override void OnEnable()
  22. {
  23. m_Scrollbar = GetComponent<Scrollbar>();
  24. m_CanvasGroup = GetComponent<CanvasGroup>();
  25. }
  26. }
  27. }