From a5f56cf5a301d8d6542988bcbffb657ae37c5470 Mon Sep 17 00:00:00 2001 From: Sinai Date: Mon, 31 May 2021 19:10:05 +1000 Subject: [PATCH] Prevent very large Texture images from overflowing outside the Texture Viewer --- src/ExplorerCore.cs | 2 +- src/UI/Inspectors/ReflectionInspector.cs | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ExplorerCore.cs b/src/ExplorerCore.cs index bdbe5ec..8df1c05 100644 --- a/src/ExplorerCore.cs +++ b/src/ExplorerCore.cs @@ -20,7 +20,7 @@ namespace UnityExplorer public static class ExplorerCore { public const string NAME = "UnityExplorer"; - public const string VERSION = "4.1.0"; + public const string VERSION = "4.1.1"; public const string AUTHOR = "Sinai"; public const string GUID = "com.sinai.unityexplorer"; diff --git a/src/UI/Inspectors/ReflectionInspector.cs b/src/UI/Inspectors/ReflectionInspector.cs index 69b0b12..881105e 100644 --- a/src/UI/Inspectors/ReflectionInspector.cs +++ b/src/UI/Inspectors/ReflectionInspector.cs @@ -617,12 +617,15 @@ namespace UnityExplorer.UI.Inspectors // Actual texture viewer - var imageObj = UIFactory.CreateUIObject("TextureViewerImage", textureViewer); - textureImage = imageObj.AddComponent(); - textureImageLayout = textureImage.gameObject.AddComponent(); + var imageViewport = UIFactory.CreateVerticalGroup(textureViewer, "Viewport", false, false, true, true); + imageViewport.GetComponent().color = Color.white; + imageViewport.AddComponent().showMaskGraphic = false; + var imageObj = UIFactory.CreateUIObject("Image", imageViewport); var fitter = imageObj.AddComponent(); fitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize; + textureImage = imageObj.AddComponent(); + textureImageLayout = UIFactory.SetLayoutElement(imageObj, flexibleWidth: 9999, flexibleHeight: 9999); textureViewer.SetActive(false); }