Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit a5f56cf

Browse files
committed
Prevent very large Texture images from overflowing outside the Texture Viewer
1 parent 8c822b2 commit a5f56cf

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/ExplorerCore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace UnityExplorer
2020
public static class ExplorerCore
2121
{
2222
public const string NAME = "UnityExplorer";
23-
public const string VERSION = "4.1.0";
23+
public const string VERSION = "4.1.1";
2424
public const string AUTHOR = "Sinai";
2525
public const string GUID = "com.sinai.unityexplorer";
2626

src/UI/Inspectors/ReflectionInspector.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,12 +617,15 @@ private void ConstructTextureHelper()
617617

618618
// Actual texture viewer
619619

620-
var imageObj = UIFactory.CreateUIObject("TextureViewerImage", textureViewer);
621-
textureImage = imageObj.AddComponent<Image>();
622-
textureImageLayout = textureImage.gameObject.AddComponent<LayoutElement>();
620+
var imageViewport = UIFactory.CreateVerticalGroup(textureViewer, "Viewport", false, false, true, true);
621+
imageViewport.GetComponent<Image>().color = Color.white;
622+
imageViewport.AddComponent<Mask>().showMaskGraphic = false;
623623

624+
var imageObj = UIFactory.CreateUIObject("Image", imageViewport);
624625
var fitter = imageObj.AddComponent<ContentSizeFitter>();
625626
fitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
627+
textureImage = imageObj.AddComponent<Image>();
628+
textureImageLayout = UIFactory.SetLayoutElement(imageObj, flexibleWidth: 9999, flexibleHeight: 9999);
626629

627630
textureViewer.SetActive(false);
628631
}

0 commit comments

Comments
 (0)