From e82dd8dc6e1cc30ab231b36508edf94ee7188d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Gonz=C3=A1lez?= Date: Wed, 12 Dec 2018 20:12:26 -0300 Subject: [PATCH] Fixed: when moving an element from a Reorderable List to another one that's empty, the element size was being reset to the default 100,100. This also happened is moving any element to the start of a it current list. This version of the fix is more correct, as it is only touching the ResetSizes() method. --- .../Controls/ReorderableList/ReorderableListElement.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Scripts/Controls/ReorderableList/ReorderableListElement.cs b/Scripts/Controls/ReorderableList/ReorderableListElement.cs index 67a4fcd..67791f7 100644 --- a/Scripts/Controls/ReorderableList/ReorderableListElement.cs +++ b/Scripts/Controls/ReorderableList/ReorderableListElement.cs @@ -88,11 +88,6 @@ namespace UnityEngine.UI.Extensions _fakeElement = new GameObject("Fake").AddComponent(); _fakeElementLE = _fakeElement.gameObject.AddComponent(); - //Set fake element initial size - _fakeElement.GetComponent().sizeDelta = _draggingObjectOriginalSize; - _fakeElementLE.preferredHeight = _draggingObjectLE.preferredHeight; - _fakeElementLE.preferredWidth = _draggingObjectLE.preferredWidth; - RefreshSizes(); //Send OnElementGrabbed Event @@ -319,10 +314,11 @@ namespace UnityEngine.UI.Extensions size = firstChild.GetComponent().rect.size; } } - + _draggingObject.sizeDelta = size; _fakeElementLE.preferredHeight = _draggingObjectLE.preferredHeight = size.y; _fakeElementLE.preferredWidth = _draggingObjectLE.preferredWidth = size.x; + _fakeElement.GetComponent().sizeDelta = size; } public void Init(ReorderableList reorderableList)