Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeldking committed Sep 13, 2024
1 parent c724b16 commit 5c8aece
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Cluster.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(","))) {
Expand Down
8 changes: 5 additions & 3 deletions src/LassoSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,10 @@ 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;
Expand Down Expand Up @@ -268,7 +270,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
Expand Down
10 changes: 5 additions & 5 deletions src/Points.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,26 +208,26 @@ export function Points({
<instancedMesh
args={[undefined, undefined, data.length]}
ref={meshRef}
onPointerUp={(e) => {
onPointerUp={e => {
if (e.intersections) {
const instanceIds = e.intersections
.map((e) => e?.instanceId)
.map(e => e?.instanceId)
.filter((i): i is NonNullable<typeof i> => i != null);

// Multi click
onPointsClicked &&
onPointsClicked(instanceIds.map((i) => data[i]));
onPointsClicked(instanceIds.map(i => data[i]));

// Single click
instanceIds.length > 0 &&
onPointClicked &&
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<typeof i> => i != null);

// Single instance callback
Expand Down
5 changes: 3 additions & 2 deletions src/ThreeDimensionalBounds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ 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
Expand Down
2 changes: 1 addition & 1 deletion src/utils/threeDimensionalUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/twoDimensionalUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit 5c8aece

Please sign in to comment.