commit
e5c329fa14
|
@ -32,6 +32,9 @@ namespace UnityEngine.UI.Extensions
|
|||
[Tooltip("Should items being dragged over this list have their sizes equalized?")]
|
||||
public bool EqualizeSizesOnDrag = false;
|
||||
|
||||
[Tooltip("Should items keep the original rotation?")]
|
||||
public bool KeepItemRotation = false;
|
||||
|
||||
[Tooltip("Maximum number of items this container can hold")]
|
||||
public int maxItems = int.MaxValue;
|
||||
|
||||
|
|
|
@ -266,7 +266,10 @@ namespace UnityEngine.UI.Extensions
|
|||
_displacedObjectLE.preferredWidth = _draggingObjectOriginalSize.x;
|
||||
_displacedObjectLE.preferredHeight = _draggingObjectOriginalSize.y;
|
||||
_displacedObject.SetParent(_reorderableList.Content, false);
|
||||
_displacedObject.rotation = _reorderableList.transform.rotation;
|
||||
if (!_reorderableList.KeepItemRotation)
|
||||
{
|
||||
_displacedObject.rotation = _reorderableList.transform.rotation;
|
||||
}
|
||||
_displacedObject.SetSiblingIndex(_fromIndex);
|
||||
// Force refreshing both lists because otherwise we get inappropriate FromList in ReorderableListEventStruct
|
||||
_reorderableList.Refresh();
|
||||
|
@ -310,7 +313,10 @@ namespace UnityEngine.UI.Extensions
|
|||
_displacedObjectLE.preferredWidth = _displacedObjectOriginalSize.x;
|
||||
_displacedObjectLE.preferredHeight = _displacedObjectOriginalSize.y;
|
||||
_displacedObject.SetParent(_displacedObjectOriginList.Content, false);
|
||||
_displacedObject.rotation = _displacedObjectOriginList.transform.rotation;
|
||||
if (!_reorderableList.KeepItemRotation)
|
||||
{
|
||||
_displacedObject.rotation = _displacedObjectOriginList.transform.rotation;
|
||||
}
|
||||
_displacedObject.SetSiblingIndex(_displacedFromIndex);
|
||||
_displacedObject.gameObject.SetActive(true);
|
||||
|
||||
|
@ -382,7 +388,10 @@ namespace UnityEngine.UI.Extensions
|
|||
|
||||
RefreshSizes();
|
||||
_draggingObject.SetParent(_currentReorderableListRaycasted.Content, false);
|
||||
_draggingObject.rotation = _currentReorderableListRaycasted.transform.rotation;
|
||||
if (!_reorderableList.KeepItemRotation)
|
||||
{
|
||||
_draggingObject.rotation = _currentReorderableListRaycasted.transform.rotation;
|
||||
}
|
||||
_draggingObject.SetSiblingIndex(_fakeElement.GetSiblingIndex());
|
||||
|
||||
//If the item is transferable, it can be dragged out again
|
||||
|
@ -474,7 +483,10 @@ namespace UnityEngine.UI.Extensions
|
|||
{
|
||||
RefreshSizes();
|
||||
_draggingObject.SetParent(_reorderableList.Content, false);
|
||||
_draggingObject.rotation = _reorderableList.Content.transform.rotation;
|
||||
if (!_reorderableList.KeepItemRotation)
|
||||
{
|
||||
_draggingObject.rotation = _reorderableList.Content.transform.rotation;
|
||||
}
|
||||
_draggingObject.SetSiblingIndex(_fromIndex);
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue