@@ -96,9 +96,10 @@ public void ValidateTabs()
9696 public int GetTabIndexAt ( PointerEventData pointer , out Vector2 tabPreviewRect ) // x: position, y: size
9797 {
9898 int tabCount = panel . tabs . Count ;
99+ float offset = panel . tabsParent . anchoredPosition . x ;
99100 if ( tabCount == 0 )
100101 {
101- tabPreviewRect = new Vector2 ( 0f , panel . Size . x ) ;
102+ tabPreviewRect = new Vector2 ( offset , panel . Size . x ) ;
102103 return 0 ;
103104 }
104105
@@ -114,7 +115,7 @@ public int GetTabIndexAt( PointerEventData pointer, out Vector2 tabPreviewRect )
114115 if ( i > 0 )
115116 i -- ;
116117
117- tabPreviewRect = new Vector2 ( tabPosition , panel . tabs [ i ] . Internal . RectTransform . sizeDelta . x + 4f ) ;
118+ tabPreviewRect = new Vector2 ( offset + tabPosition , panel . tabs [ i ] . Internal . RectTransform . sizeDelta . x ) ;
118119 return i ;
119120 }
120121
@@ -126,16 +127,16 @@ public int GetTabIndexAt( PointerEventData pointer, out Vector2 tabPreviewRect )
126127 {
127128 float remainingSize = panel . Size . x - tabPosition - tabSize ;
128129 if ( remainingSize < 30f )
129- tabPreviewRect = new Vector2 ( tabPosition + tabSize * 0.5f , remainingSize + tabSize * 0.5f ) ;
130+ tabPreviewRect = new Vector2 ( offset + tabPosition + tabSize * 0.5f , remainingSize + tabSize * 0.5f ) ;
130131 else if ( remainingSize > tabSize )
131- tabPreviewRect = new Vector2 ( tabPosition + tabSize , tabSize ) ;
132+ tabPreviewRect = new Vector2 ( offset + tabPosition + tabSize , tabSize ) ;
132133 else
133- tabPreviewRect = new Vector2 ( tabPosition + tabSize , remainingSize ) ;
134+ tabPreviewRect = new Vector2 ( offset + tabPosition + tabSize , remainingSize ) ;
134135
135136 return tabCount ;
136137 }
137138
138- tabPreviewRect = new Vector2 ( tabPosition , tabSize + 4f ) ;
139+ tabPreviewRect = new Vector2 ( offset + tabPosition , tabSize ) ;
139140 return tabCount - 1 ;
140141 }
141142
0 commit comments