mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-26 13:49:01 -05:00
optimised Pairs.removeOld
This commit is contained in:
parent
1073ddeecf
commit
a882a74cd5
1 changed files with 2 additions and 1 deletions
|
@ -111,6 +111,7 @@ var Common = require('../core/Common');
|
||||||
var pairsList = pairs.list,
|
var pairsList = pairs.list,
|
||||||
pairsTable = pairs.table,
|
pairsTable = pairs.table,
|
||||||
indexesToRemove = [],
|
indexesToRemove = [],
|
||||||
|
pairMaxIdleLife = Pairs._pairMaxIdleLife,
|
||||||
pair,
|
pair,
|
||||||
collision,
|
collision,
|
||||||
pairIndex,
|
pairIndex,
|
||||||
|
@ -127,7 +128,7 @@ var Common = require('../core/Common');
|
||||||
}
|
}
|
||||||
|
|
||||||
// if pair is inactive for too long, mark it to be removed
|
// if pair is inactive for too long, mark it to be removed
|
||||||
if (timestamp - pair.timeUpdated > Pairs._pairMaxIdleLife) {
|
if (timestamp - pair.timeUpdated > pairMaxIdleLife) {
|
||||||
indexesToRemove.push(i);
|
indexesToRemove.push(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue