Skip to content

Commit

Permalink
map to forEach, per discussion on PR
Browse files Browse the repository at this point in the history
  • Loading branch information
machenmusik committed Mar 2, 2017
1 parent 096f21c commit 3b8199b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/components/oculus-touch-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,13 @@ module.exports.Component = registerComponent('oculus-touch-controls', {
// In theory, it might be better to use mapping from axis to control.
// In practice, it is not clear whether the additional overhead is worthwhile,
// and if we did grouping of axes, we really need de-duplication there.
Object.keys(axesMapping).map(function (key) {
Object.keys(axesMapping).forEach(function (key) {
var value = axesMapping[key];
var detail = {};
var changed = !evt.detail.changed;
if (!changed) { value.map(function (axisNumber) { changed |= evt.detail.changed[axisNumber]; }); }
if (!changed) { value.forEach(function (axisNumber) { changed |= evt.detail.changed[axisNumber]; }); }
if (changed) {
value.map(function (axisNumber) { detail[self.axisLabels[axisNumber]] = evt.detail.axis[axisNumber]; });
value.forEach(function (axisNumber) { detail[self.axisLabels[axisNumber]] = evt.detail.axis[axisNumber]; });
self.el.emit(key + 'moved', detail);
// If we updated the model based on axis values, that call would go here.
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/vive-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,13 @@ module.exports.Component = registerComponent('vive-controls', {
// In theory, it might be better to use mapping from axis to control.
// In practice, it is not clear whether the additional overhead is worthwhile,
// and if we did grouping of axes, we really need de-duplication there.
Object.keys(axesMapping).map(function (key) {
Object.keys(axesMapping).forEach(function (key) {
var value = axesMapping[key];
var detail = {};
var changed = !evt.detail.changed;
if (!changed) { value.map(function (axisNumber) { changed |= evt.detail.changed[axisNumber]; }); }
if (!changed) { value.forEach(function (axisNumber) { changed |= evt.detail.changed[axisNumber]; }); }
if (changed) {
value.map(function (axisNumber) { detail[self.axisLabels[axisNumber]] = evt.detail.axis[axisNumber]; });
value.forEach(function (axisNumber) { detail[self.axisLabels[axisNumber]] = evt.detail.axis[axisNumber]; });
self.el.emit(key + 'moved', detail);
// If we updated the model based on axis values, that call would go here.
}
Expand Down

0 comments on commit 3b8199b

Please sign in to comment.