diff --git a/Assets/Prefabs/UI/Hierarchy.prefab b/Assets/Prefabs/UI/Hierarchy.prefab index 671a3171..9a679d73 100644 --- a/Assets/Prefabs/UI/Hierarchy.prefab +++ b/Assets/Prefabs/UI/Hierarchy.prefab @@ -612,6 +612,14 @@ PrefabInstance: propertyPath: m_Size value: 1 objectReference: {fileID: 0} + - target: {fileID: 3692082455671801088, guid: c7fa5154df436e54bb0b444dfc25575d, type: 3} + propertyPath: isDraggable + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3692082455671801088, guid: c7fa5154df436e54bb0b444dfc25575d, type: 3} + propertyPath: isSiblingEditable + value: 1 + objectReference: {fileID: 0} - target: {fileID: 3853414527505018043, guid: c7fa5154df436e54bb0b444dfc25575d, type: 3} propertyPath: m_AnchorMax.x value: 1 @@ -658,7 +666,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4494893725557815844, guid: c7fa5154df436e54bb0b444dfc25575d, type: 3} propertyPath: m_Value - value: 1 + value: 1.0000204 objectReference: {fileID: 0} - target: {fileID: 5185907358101567880, guid: c7fa5154df436e54bb0b444dfc25575d, type: 3} propertyPath: m_Maskable diff --git a/Assets/Scripts/Studio/UI/TreeView/CustomScrollRect.cs b/Assets/Scripts/Studio/UI/TreeView/CustomScrollRect.cs index e62d0f9f..316469ba 100644 --- a/Assets/Scripts/Studio/UI/TreeView/CustomScrollRect.cs +++ b/Assets/Scripts/Studio/UI/TreeView/CustomScrollRect.cs @@ -24,6 +24,11 @@ namespace XED.Hierarchy private Coroutine coroutinePendPopup; public override void OnBeginDrag(PointerEventData eventData) { + ScrollItemUI itemUI = GetTargetItemUI(eventData); + if (itemUI != null && !itemUI.isSelected) + { + itemUI.OnPointerClick(eventData); + } onDragBegin?.Invoke(sourceItem); if (!passDragToChildren) { diff --git a/Assets/Scripts/Studio/UI/TreeView/PooledScrollView.cs b/Assets/Scripts/Studio/UI/TreeView/PooledScrollView.cs index 77a502a0..a16df68d 100644 --- a/Assets/Scripts/Studio/UI/TreeView/PooledScrollView.cs +++ b/Assets/Scripts/Studio/UI/TreeView/PooledScrollView.cs @@ -35,6 +35,9 @@ namespace XED.Hierarchy public UnityEvent> onSelect; public UnityEvent onParentChanged; + + public bool isSiblingEditable; + private void Awake() { content = UtilityFunction.FindDeepChild(transform, "Content").GetComponent(); @@ -331,7 +334,7 @@ namespace XED.Hierarchy } public void SetToChildItem(HierarchyItem srcItem, HierarchyItem destItem) { - if (srcItem == null || destItem == null) + if (srcItem == null || destItem == null || !isSiblingEditable) return; if (selectedItems.Contains(srcItem)) { @@ -384,7 +387,7 @@ namespace XED.Hierarchy } public void SetToNextSiblingItem(HierarchyItem srcItem, HierarchyItem destItem) { - if (srcItem == null || destItem == null) + if (srcItem == null || destItem == null || !isSiblingEditable) return; if (selectedItems.Contains(srcItem)) { @@ -437,7 +440,7 @@ namespace XED.Hierarchy } public void SetToPriorSiblingItem(HierarchyItem srcItem, HierarchyItem destItem) { - if (srcItem == null || destItem == null) + if (srcItem == null || destItem == null || !isSiblingEditable) return; if (selectedItems.Contains(srcItem)) { diff --git a/Assets/Scripts/Studio/UI/TreeView/ScrollItemUI.cs b/Assets/Scripts/Studio/UI/TreeView/ScrollItemUI.cs index 6a8c9870..9f71ea95 100644 --- a/Assets/Scripts/Studio/UI/TreeView/ScrollItemUI.cs +++ b/Assets/Scripts/Studio/UI/TreeView/ScrollItemUI.cs @@ -33,6 +33,7 @@ namespace XED.Hierarchy public GameObject highLight; public List itemSprites; private Image backgroundImage; + public bool isSelected; private void Awake() { backgroundImage = GetComponent(); @@ -69,7 +70,8 @@ namespace XED.Hierarchy } public void SetSelected(bool selected) { - if (selected) + isSelected = selected; + if (isSelected) { backgroundImage.color = selectedColor; } @@ -80,7 +82,8 @@ namespace XED.Hierarchy } public void SetSelected(List selectedItems) { - if (selectedItems.Contains(currentItem)) + isSelected = selectedItems.Contains(currentItem); + if (isSelected) { backgroundImage.color = selectedColor; }