diff --git a/src/grid.js b/src/grid.js index 86c8c3a..3e83f80 100644 --- a/src/grid.js +++ b/src/grid.js @@ -33,7 +33,11 @@ Grid.prototype = { for (let x = tlCellX; x <= brCellX; x++) { for (let y = tlCellY; y <= brCellY; y++) { - Array.prototype.push.apply(points, this.cellPoints(x, y)); + + // replaced Array.prototype.push.apply to avoid hitting stack size limit on larger arrays. + for(let i = 0; i < this.cellPoints(x, y).length; i++){ + points.push(this.cellPoints(x, y)[i]); + } } }