@@ -9,6 +9,7 @@ namespace kojac {
99 const LERP_SPEED = 12 ;
1010 const SEARCH_INCR = 8 ;
1111 const SEARCH_MAX = 160 ;
12+ const SEARCH_SLOPE = 1.8 ;
1213
1314 export class Cursor extends Component {
1415 stylus : Kelpie ;
@@ -62,7 +63,7 @@ namespace kojac {
6263 boundsFn : ( dist : number ) => Bounds ;
6364 filterFn : ( value : Button , dist : number ) => boolean ;
6465 } ) {
65- if ( this . transiting ( ) ) return ;
66+ // if (this.transiting()) return;
6667 let dist = SEARCH_INCR ;
6768 let candidates : Button [ ] ;
6869 let overlapping = this . getOverlapping ( ) ;
@@ -109,7 +110,7 @@ namespace kojac {
109110 // Filter to upward buttons that are more up than left or right from us.
110111 return (
111112 pos . y < this . y &&
112- Math . abs ( pos . y - this . y ) > Math . abs ( pos . x - this . x ) ) ;
113+ ( Math . abs ( pos . y - this . y ) / Math . abs ( pos . x - this . x ) ) > SEARCH_SLOPE ) ;
113114 }
114115 } ) ;
115116 }
@@ -129,7 +130,7 @@ namespace kojac {
129130 // Filter to downward buttons that are more down than left or right from us.
130131 return (
131132 pos . y > this . y &&
132- Math . abs ( pos . y - this . y ) > Math . abs ( pos . x - this . x ) ) ;
133+ ( Math . abs ( pos . y - this . y ) / Math . abs ( pos . x - this . x ) ) > SEARCH_SLOPE ) ;
133134 }
134135 } ) ;
135136 }
@@ -149,7 +150,7 @@ namespace kojac {
149150 // Filter to leftward buttons that are more left than up or down from us.
150151 return (
151152 pos . x < this . x &&
152- Math . abs ( pos . y - this . y ) < Math . abs ( pos . x - this . x ) ) ;
153+ ( Math . abs ( pos . x - this . x ) / Math . abs ( pos . y - this . y ) ) > SEARCH_SLOPE ) ;
153154 }
154155 } ) ;
155156 }
@@ -169,7 +170,7 @@ namespace kojac {
169170 // Filter to rightward buttons that are to more right than up or down from us.
170171 return (
171172 pos . x > this . x &&
172- Math . abs ( pos . y - this . y ) < Math . abs ( pos . x - this . x ) ) ;
173+ ( Math . abs ( pos . x - this . x ) / Math . abs ( pos . y - this . y ) ) > SEARCH_SLOPE ) ;
173174 }
174175 } ) ;
175176 }
0 commit comments