Skip to content

Commit

Permalink
Refactor 유틸 함수 (Squash)
Browse files Browse the repository at this point in the history
Refactor 함수 선언문 통일
  • Loading branch information
whoisrey committed Dec 15, 2024
1 parent 68ed113 commit ef98b47
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/utils/calculators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@ function calculateNewPosition(
return initialPosition.clone().add(delta);
}

const constrainPosition = (
function constrainPosition(
newPosition: Vector3,
size: number,
ROOM_SIZE: number,
) => {
) {
const halfSize = ROOM_SIZE / 2 - size;

newPosition.x = Math.max(-halfSize, Math.min(halfSize, newPosition.x));
newPosition.z = Math.max(-halfSize, Math.min(halfSize, newPosition.z));
};
}

const calculatePan = (
function calculatePan(
listenerPosition: Vector3Values,
speakerPosition: Vector3Values,
): number => {
): number {
const distanceX = listenerPosition[0] - speakerPosition[0];
const distanceZ = listenerPosition[2] - speakerPosition[2];

Expand All @@ -62,7 +62,7 @@ const calculatePan = (
const pan = Math.cos(azimuth);

return pan;
};
}

export {
calculateSliderValue,
Expand Down
4 changes: 3 additions & 1 deletion src/utils/creators.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MeshBasicMaterial, BoxGeometry, Mesh } from "three";

export function createCeilingIndicator() {
function createCeilingIndicator() {
const material = new MeshBasicMaterial({
color: 0x00ff00,
transparent: true,
Expand All @@ -10,3 +10,5 @@ export function createCeilingIndicator() {

return new Mesh(geometry, material);
}

export { createCeilingIndicator };
1 change: 1 addition & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export default defineConfig({
plugins: [react()],
test: {
globals: true,
include: ["**/utils/*.test.{ts,tsx}"],
},
});

0 comments on commit ef98b47

Please sign in to comment.