From a06de2087227da97b46aee0ba51b1589f281f07b Mon Sep 17 00:00:00 2001 From: Tony Powell Date: Fri, 6 Dec 2024 10:30:04 -0500 Subject: [PATCH] Add prettier to dev deps to support CI --- package.json | 1 + src/Cluster.tsx | 2 +- src/LassoSelect.tsx | 8 +++----- src/Points.tsx | 10 +++++----- src/ThreeDimensionalBounds.tsx | 5 ++--- src/utils/threeDimensionalUtils.ts | 2 +- src/utils/twoDimensionalUtils.ts | 2 +- 7 files changed, 14 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 9db1358c..e390aeee 100644 --- a/package.json +++ b/package.json @@ -93,6 +93,7 @@ "eslint-plugin-react-hooks": "^4.6.2", "eslint-plugin-unused-imports": "^3.1.0", "husky": "^7.0.4", + "prettier": "^3.4.2", "react": "18", "react-dom": "18", "react-is": "^18.1.0", diff --git a/src/Cluster.tsx b/src/Cluster.tsx index 0a58f4bd..7bc5cde5 100644 --- a/src/Cluster.tsx +++ b/src/Cluster.tsx @@ -43,7 +43,7 @@ export function Cluster({ const geometries: THREE.SphereGeometry[] = []; // Keep track of the points added so that we can remove duplicates const pointSet = new Set(); - data.forEach(point => { + data.forEach((point) => { const { position } = point; // Remove duplicates if (!pointSet.has(position.join(","))) { diff --git a/src/LassoSelect.tsx b/src/LassoSelect.tsx index 8e5070c1..f0cff596 100644 --- a/src/LassoSelect.tsx +++ b/src/LassoSelect.tsx @@ -191,10 +191,8 @@ export function LassoSelect({ // Animation frames to draw the selections useFrame(({ camera }) => { - const { - selectionShapeNeedsUpdate, - selectionPoints, - } = selectionState.current; + const { selectionShapeNeedsUpdate, selectionPoints } = + selectionState.current; // Update the selection lasso lines if (selectionShapeNeedsUpdate) { const ogLength = selectionPoints.length; @@ -270,7 +268,7 @@ function updateSelection({ // A vector to re-use in calculating it's intersection with the polygon const pointVector = new THREE.Vector3(); - points.forEach(point => { + points.forEach((point) => { const isThreeD = point.position.length === 3; // Initialize the point vector from the point position const pointPosition = isThreeD diff --git a/src/Points.tsx b/src/Points.tsx index fda49e3b..1978548e 100644 --- a/src/Points.tsx +++ b/src/Points.tsx @@ -208,15 +208,15 @@ export function Points({ { + onPointerUp={(e) => { if (e.intersections) { const instanceIds = e.intersections - .map(e => e?.instanceId) + .map((e) => e?.instanceId) .filter((i): i is NonNullable => i != null); // Multi click onPointsClicked && - onPointsClicked(instanceIds.map(i => data[i])); + onPointsClicked(instanceIds.map((i) => data[i])); // Single click instanceIds.length > 0 && @@ -224,10 +224,10 @@ export function Points({ onPointClicked(data[instanceIds[0]]); } }} - onPointerOver={e => { + onPointerOver={(e) => { if (e.intersections) { const instanceIds = e.intersections - .map(e => e?.instanceId) + .map((e) => e?.instanceId) .filter((i): i is NonNullable => i != null); // Single instance callback diff --git a/src/ThreeDimensionalBounds.tsx b/src/ThreeDimensionalBounds.tsx index 1fbbfda9..ce740471 100644 --- a/src/ThreeDimensionalBounds.tsx +++ b/src/ThreeDimensionalBounds.tsx @@ -74,9 +74,8 @@ export function ThreeDimensionalBounds({ camera.zoom = Math.min(width / boundsWidth, height / boundsHeight) * boundsZoomPaddingFactor; - const furthestPointDim = getMaxDimensionFromThreeDimensionalBounds( - bounds, - ); + const furthestPointDim = + getMaxDimensionFromThreeDimensionalBounds(bounds); // Set the camera position to be a bit further away than the furthest coordinate value, to allow for rotation of the cloud without clipping through the near plane // The default near value is .1, so if we move the camera back this far, we are guaranteed to be not clip the near plane diff --git a/src/utils/threeDimensionalUtils.ts b/src/utils/threeDimensionalUtils.ts index 316ca62f..4b9a65c3 100644 --- a/src/utils/threeDimensionalUtils.ts +++ b/src/utils/threeDimensionalUtils.ts @@ -34,7 +34,7 @@ export function getThreeDimensionalBounds( minZ = Infinity, maxZ = -Infinity; - points.forEach(p => { + points.forEach((p) => { minX = Math.min(minX, p[0]); minY = Math.min(minY, p[1]); minZ = Math.min(minZ, p[2]); diff --git a/src/utils/twoDimensionalUtils.ts b/src/utils/twoDimensionalUtils.ts index 7659691b..7a324b22 100644 --- a/src/utils/twoDimensionalUtils.ts +++ b/src/utils/twoDimensionalUtils.ts @@ -30,7 +30,7 @@ export function getTwoDimensionalBounds( maxX = -Infinity, maxY = -Infinity; - points.forEach(p => { + points.forEach((p) => { minX = Math.min(minX, p[0]); minY = Math.min(minY, p[1]); maxX = Math.max(maxX, p[0]);