File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ const log = require('./util/log');
13
13
* @type {twgl.v3 }
14
14
*/
15
15
const __isTouchingPosition = twgl . v3 . create ( ) ;
16
+ const FLOATING_POINT_ERROR_ALLOWANCE = 1e-6 ;
16
17
17
18
/**
18
19
* Convert a scratch space location into a texture space float. Uses the
@@ -39,8 +40,8 @@ const getLocalPosition = (drawable, vec) => {
39
40
localPosition [ 1 ] = ( ( ( v0 * m [ 1 ] ) + ( v1 * m [ 5 ] ) + m [ 13 ] ) / d ) + 0.5 ;
40
41
// Fix floating point issues near 0.
41
42
// TODO: Check if this can be removed after render pull 479 is merged
42
- if ( Math . abs ( localPosition [ 0 ] < 1e-8 ) ) localPosition [ 0 ] = 0 ;
43
- if ( Math . abs ( localPosition [ 1 ] < 1e-8 ) ) localPosition [ 1 ] = 0 ;
43
+ if ( Math . abs ( localPosition [ 0 ] ) < FLOATING_POINT_ERROR_ALLOWANCE ) localPosition [ 0 ] = 0 ;
44
+ if ( Math . abs ( localPosition [ 1 ] ) < FLOATING_POINT_ERROR_ALLOWANCE ) localPosition [ 1 ] = 0 ;
44
45
// Apply texture effect transform if the localPosition is within the drawable's space,
45
46
// and any effects are currently active.
46
47
if ( drawable . enabledEffects !== 0 &&
You can’t perform that action at this time.
0 commit comments