diff --git a/src/layers/hexbin.js b/src/layers/hexbin.js index 2bfa280..3dbc665 100755 --- a/src/layers/hexbin.js +++ b/src/layers/hexbin.js @@ -195,8 +195,9 @@ export default Kapsule({ // update surfaceRadius per vertex const vertexSurfaceRadius = GLOBE_RADIUS / (alt + 1); obj.geometry.setAttribute('surfaceRadius', array2BufferAttr( - [...new Array(obj.geometry.getAttribute('position').count)].map(() => vertexSurfaceRadius), 1) - ); + Array(obj.geometry.getAttribute('position').count).fill(vertexSurfaceRadius), + 1 + )); }; const currentTargetD = obj.__currentTargetD || Object.assign({}, targetD, { alt: -1e-3 }); diff --git a/src/layers/points.js b/src/layers/points.js index 4d43592..47772a8 100755 --- a/src/layers/points.js +++ b/src/layers/points.js @@ -98,7 +98,7 @@ export default Kapsule({ // color vertices const color = color2ShaderArr(colorAccessor(d)); geom.setAttribute('color', array2BufferAttr( - [...new Array(geom.getAttribute('position').count)].map(() => color), + Array(geom.getAttribute('position').count).fill(color), 4 )); diff --git a/src/utils/interpolate.js b/src/utils/interpolate.js index c0abfd9..6643254 100644 --- a/src/utils/interpolate.js +++ b/src/utils/interpolate.js @@ -8,7 +8,7 @@ const THREE = window.THREE export function interpolateVectors(fromPnts, toPnts) { const extendArr = (arr, length) => { const repeatItem = arr[arr.length-1]; - return [...arr, ...[...new Array(length - arr.length)].map(() => repeatItem)]; + return [...arr, ...Array(length - arr.length).fill(repeatItem)]; }; const arrLength = Math.max(fromPnts.length, toPnts.length);