File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ void Modify(ref List<UIVertex> vertices)
140140 var mergedRects = new List < Rect > ( ) ;
141141 foreach ( var charRects in SplitRectsByRow ( entry . Rects ) )
142142 {
143- mergedRects . Add ( MergeRects ( charRects ) ) ;
143+ mergedRects . Add ( CalculateAABB ( charRects ) ) ;
144144 }
145145
146146 entry . Rects = mergedRects ;
@@ -170,7 +170,7 @@ List<List<Rect>> SplitRectsByRow(List<Rect> rects)
170170 return rectsList ;
171171 }
172172
173- Rect MergeRects ( List < Rect > rects )
173+ Rect CalculateAABB ( List < Rect > rects )
174174 {
175175 var min = Vector2 . one * float . MaxValue ;
176176 var max = Vector2 . one * float . MinValue ;
@@ -222,22 +222,15 @@ void IPointerClickHandler.OnPointerClick(PointerEventData eventData)
222222 {
223223 var localPosition = ToLocalPosition ( eventData . position , eventData . pressEventCamera ) ;
224224
225- foreach ( var entry in _entries )
225+ for ( int i = 0 ; i < _entries . Count ; i ++ )
226226 {
227- if ( entry . OnClick == null )
227+ for ( int j = 0 ; j < _entries [ i ] . Rects . Count ; j ++ )
228228 {
229- continue ;
230- }
231-
232- foreach ( var rect in entry . Rects )
233- {
234- if ( ! rect . Contains ( localPosition ) )
229+ if ( _entries [ i ] . Rects [ j ] . Contains ( localPosition ) )
235230 {
236- continue ;
231+ _entries [ i ] . OnClick ( _entries [ i ] . Word ) ;
232+ break ;
237233 }
238-
239- entry . OnClick ( entry . Word ) ;
240- break ;
241234 }
242235 }
243236 }
You can’t perform that action at this time.
0 commit comments