@@ -44,12 +44,13 @@ function focusNavigationHeuristics(spatnavPolyfillOptions) {
44
44
e . preventDefault ( ) ;
45
45
navigate ( dir ) ;
46
46
}
47
+ startingPosition = null ;
47
48
} ) ;
48
49
49
50
/*
50
- * mouseclick EventListener :
51
- * If the mouse click a point in the page, the point will be the starting point.
52
- */
51
+ * mouseclick EventListener :
52
+ * If the mouse click a point in the page, the point will be the starting point.
53
+ */
53
54
document . addEventListener ( 'click' , function ( e ) {
54
55
startingPosition = { xPosition : e . clientX , yPosition : e . clientY } ;
55
56
} ) ;
@@ -124,7 +125,7 @@ function focusNavigationHeuristics(spatnavPolyfillOptions) {
124
125
125
126
if ( Array . isArray ( candidates ) && candidates . length > 0 ) {
126
127
// 9
127
- const bestCandidate = selectBestCandidate ( eventTarget , candidates , dir , container ) ;
128
+ const bestCandidate = selectBestCandidate ( eventTarget , candidates , dir ) ;
128
129
if ( bestCandidate ) {
129
130
// 10 & 11
130
131
focusingController ( bestCandidate , dir ) ;
@@ -261,7 +262,7 @@ function focusNavigationHeuristics(spatnavPolyfillOptions) {
261
262
if ( ( isContainer ( this ) || this . nodeName === 'BODY' ) && ! ( this . nodeName === 'INPUT' ) )
262
263
bestCandidate = selectBestCandidateFromEdge ( this , candidates_ , dir ) ;
263
264
else
264
- bestCandidate = selectBestCandidate ( this , candidates_ , dir , container_ ) ;
265
+ bestCandidate = selectBestCandidate ( this , candidates_ , dir ) ;
265
266
}
266
267
267
268
return bestCandidate ;
@@ -854,8 +855,8 @@ function focusNavigationHeuristics(spatnavPolyfillOptions) {
854
855
* @param {SpatialNavigationDirection } direction
855
856
* @returns {distance } euclidian distance between two elements
856
857
*/
857
- function getEntryAndExitPoints ( rect1 , rect2 , dir ) {
858
- const points = { entryPoint :[ 0 , 0 ] , exitPoint :[ 0 , 0 ] } ;
858
+ function getEntryAndExitPoints ( dir = 'down' , rect1 , rect2 ) {
859
+ let points = { entryPoint :[ 0 , 0 ] , exitPoint :[ 0 , 0 ] } ;
859
860
860
861
// Set direction
861
862
switch ( dir ) {
0 commit comments