Keep Item Rotation configuration.
parent
35b9985bf2
commit
10b90c4fb0
|
@ -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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
if (!_reorderableList.KeepItemRotation)
|
||||
{
|
||||
_draggingObject.rotation = _reorderableList.Content.transform.rotation;
|
||||
}
|
||||
_draggingObject.SetSiblingIndex(_fromIndex);
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue