PDFThumbnailItem.cs 759 B

1234567891011121314151617181920212223242526
  1. using UnityEngine;
  2. using UnityEngine.EventSystems;
  3. using UnityEngine.UI;
  4. namespace Paroxe.PdfRenderer.Internal.Viewer
  5. {
  6. public class PDFThumbnailItem : UIBehaviour
  7. {
  8. public AspectRatioFitter m_AspectRatioFitter;
  9. public Image m_Highlighted;
  10. public LayoutElement m_LayoutElement;
  11. public Text m_PageIndexLabel;
  12. public RawImage m_PageThumbnailRawImage;
  13. public RectTransform m_RectTransform;
  14. public void LateUpdate()
  15. {
  16. m_LayoutElement.preferredHeight = 180.0f * (m_RectTransform.sizeDelta.x / 320.0f);
  17. }
  18. public void OnThumbnailClicked()
  19. {
  20. GetComponentInParent<PDFViewer>().GoToPage(int.Parse(m_PageIndexLabel.text) - 1);
  21. }
  22. }
  23. }