@@ -11,8 +11,17 @@ var ProcessOverOutEvents = function (pointer)
1111 var stillOver = [ ] ;
1212 var previouslyOver = this . _over [ pointer . id ] ;
1313
14+ if ( this . topOnly && currentlyOver . length )
15+ {
16+ this . sortGameObjects ( currentlyOver ) ;
17+
18+ // Only the top-most one counts now, ignore the rest
19+ currentlyOver . splice ( 1 ) ;
20+ }
21+
1422 // Go through all objects the pointer was previously over, and see if it still is.
1523 // Splits the previouslyOver array into two parts: justOut and stillOver
24+
1625 for ( i = 0 ; i < previouslyOver . length ; i ++ )
1726 {
1827 gameObject = previouslyOver [ i ] ;
@@ -29,7 +38,7 @@ var ProcessOverOutEvents = function (pointer)
2938 }
3039 }
3140
32- // Go through the hit test results (the contents of currentlyOver )
41+ // Go through all objects the pointer is currently over (the hit test results )
3342 // and if not in the previouslyOver array we know it's a new entry, so add to justOver
3443 for ( i = 0 ; i < currentlyOver . length ; i ++ )
3544 {
@@ -45,25 +54,6 @@ var ProcessOverOutEvents = function (pointer)
4554
4655 // By this point the arrays are filled, so now we can process what happened...
4756
48- // In a topOnly situation a new justOver entry at the top
49- // should clear all previous justOut entries and ignore the rest of the stillOver entries
50-
51- if ( this . topOnly && justOver . length )
52- {
53- this . sortGameObjects ( justOver ) ;
54-
55- // Only the top-most one counts now, ignore the rest
56- var topObject = justOver . shift ( ) ;
57-
58- console . log ( 'topOnly' , topObject . name ) ;
59-
60- justOver = [ topObject ] ;
61-
62- justOut = justOut . concat ( stillOver ) ;
63-
64- stillOver . length = 0 ;
65- }
66-
6757 // Process the Just Out objects
6858 var total = justOut . length ;
6959
0 commit comments