File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -134,13 +134,11 @@ AFRAME.registerComponent('super-hands', {
134134 this . onDragDropEndButton ( )
135135 } ,
136136 tick : ( function ( ) {
137- let orderChanged = false
138137 // closer objects and objects with no distance come later in list
139138 function sorter ( a , b ) {
140139 const aDist = a . distance == null ? - 1 : a . distance
141140 const bDist = b . distance == null ? - 1 : b . distance
142141 if ( aDist < bDist ) {
143- orderChanged = true
144142 return 1
145143 }
146144 if ( bDist < aDist ) {
@@ -154,12 +152,15 @@ AFRAME.registerComponent('super-hands', {
154152 if ( prevCheckTime && ( time - prevCheckTime < data . interval ) ) { return }
155153 this . prevCheckTime = time
156154
157- orderChanged = false
155+ let orderChanged = false
158156 this . hoverElsIntersections . sort ( sorter )
159- if ( orderChanged ) {
160- for ( let i = 0 ; i < this . hoverElsIntersections . length ; i ++ ) {
157+ for ( let i = 0 ; i < this . hoverElsIntersections . length ; i ++ ) {
158+ if ( this . hoverEls [ i ] !== this . hoverElsIntersections [ i ] . object . el ) {
159+ orderChanged = true
161160 this . hoverEls [ i ] = this . hoverElsIntersections [ i ] . object . el
162161 }
162+ }
163+ if ( orderChanged ) {
163164 this . hover ( )
164165 }
165166 }
You can’t perform that action at this time.
0 commit comments