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.
pull/413/head
Jesús González 2018-12-12 20:12:26 -03:00
parent e35ff7d933
commit e82dd8dc6e
1 changed files with 2 additions and 6 deletions

View File

@ -88,11 +88,6 @@ namespace UnityEngine.UI.Extensions
_fakeElement = new GameObject("Fake").AddComponent<RectTransform>(); _fakeElement = new GameObject("Fake").AddComponent<RectTransform>();
_fakeElementLE = _fakeElement.gameObject.AddComponent<LayoutElement>(); _fakeElementLE = _fakeElement.gameObject.AddComponent<LayoutElement>();
//Set fake element initial size
_fakeElement.GetComponent<RectTransform>().sizeDelta = _draggingObjectOriginalSize;
_fakeElementLE.preferredHeight = _draggingObjectLE.preferredHeight;
_fakeElementLE.preferredWidth = _draggingObjectLE.preferredWidth;
RefreshSizes(); RefreshSizes();
//Send OnElementGrabbed Event //Send OnElementGrabbed Event
@ -319,10 +314,11 @@ namespace UnityEngine.UI.Extensions
size = firstChild.GetComponent<RectTransform>().rect.size; size = firstChild.GetComponent<RectTransform>().rect.size;
} }
} }
_draggingObject.sizeDelta = size; _draggingObject.sizeDelta = size;
_fakeElementLE.preferredHeight = _draggingObjectLE.preferredHeight = size.y; _fakeElementLE.preferredHeight = _draggingObjectLE.preferredHeight = size.y;
_fakeElementLE.preferredWidth = _draggingObjectLE.preferredWidth = size.x; _fakeElementLE.preferredWidth = _draggingObjectLE.preferredWidth = size.x;
_fakeElement.GetComponent<RectTransform>().sizeDelta = size;
} }
public void Init(ReorderableList reorderableList) public void Init(ReorderableList reorderableList)