Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
Previous attempt didn't preserve this in forEach() callback.  This version should work better (while still only using ES5 constructs).
  • Loading branch information
diarmidmackenzie committed Nov 5, 2023
1 parent b9d3133 commit 6217b74
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/hand-tracking-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ module.exports.Component = registerComponent('hand-tracking-controls', {
if (!controller || !this.mesh) { return; }
this.mesh.visible = false;
if (!this.hasPoses) { return; }
controller.hand.values().forEach(function (inputjoint) {
var inputjoints = controller.hand.values();
for (var i = 0; i < inputjoints.length; i++) {

Check failure on line 191 in src/components/hand-tracking-controls.js

View workflow job for this annotation

GitHub Actions / Test Cases (16.x, latest)

'i' is already defined
var inputjoint = inputjoints[i];
var bone = this.getBone(inputjoint.jointName);
if (bone != null) {
this.mesh.visible = true;
Expand All @@ -196,7 +198,7 @@ module.exports.Component = registerComponent('hand-tracking-controls', {
bone.quaternion.setFromRotationMatrix(jointPose);
}
i++;
});
}
};
})(),

Expand Down

0 comments on commit 6217b74

Please sign in to comment.