diff --git a/src/components/look-on-mobile.js b/src/components/look-on-mobile.js index 94288df1ddc322acafa3226c6b67faea54569230..1d62ca9c6ff2a7dc5fdea3b235430e57fbda0461 100644 --- a/src/components/look-on-mobile.js +++ b/src/components/look-on-mobile.js @@ -34,7 +34,10 @@ const difference = (curr, prev) => { const average = a => { let sum = 0; - a.forEach(n => (sum += n)); + for (let index of a) { + const n = a[index]; + sum += n; + } return sum / a.length; }; diff --git a/src/utils/touch-events-handler.js b/src/utils/touch-events-handler.js index 9f82888d50c2c131db243ac55fa562cfbbb21ba7..5b6341cfc57f85bc7520c578f3182c2fa83c11bf 100644 --- a/src/utils/touch-events-handler.js +++ b/src/utils/touch-events-handler.js @@ -40,7 +40,9 @@ export default class TouchEventsHandler { } handleTouchStart(e) { - Array.prototype.forEach.call(e.changedTouches, this.singleTouchStart); + for (let i = 0; i < e.changedTouches.length; i++) { + this.singleTouchStart(e.changedTouches[i]); + } } singleTouchStart(touch) { @@ -58,7 +60,9 @@ export default class TouchEventsHandler { } handleTouchMove(e) { - Array.prototype.forEach.call(e.touches, this.singleTouchMove); + for (let i = 0; i < e.touches.length; i++) { + this.singleTouchMove(e.touches[i]); + } if (this.needsPinch) { this.pinch(); this.needsPinch = false; @@ -123,7 +127,9 @@ export default class TouchEventsHandler { } handleTouchEnd(e) { - Array.prototype.forEach.call(e.changedTouches, this.singleTouchEnd); + for (let i = 0; i < e.changedTouches.length; i++) { + this.singleTouchEnd(e.changedTouches[i]); + } } singleTouchEnd(touch) {