Skip to content

Commit

Permalink
refactor(style): request changes improvements
Browse files Browse the repository at this point in the history
### description

- Remove redundant suffixes
- Add missing types to callbacks params
  • Loading branch information
Neosoulink committed Jun 29, 2024
1 parent 274e067 commit f483b4f
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/components/Physics.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { useLoop } from '@tresjs/core'
import { useRapierContextProvider } from '../composables/useRapier'
import type { PhysicsProps } from '../types/physics.type'
import type { PhysicsProps } from '../types/physics'
import Debug from './Debug.vue'
withDefaults(
Expand Down
14 changes: 7 additions & 7 deletions src/components/RigidBody.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { type TresObject, useLoop } from '@tresjs/core'
import { InstancedMesh } from 'three'
import { useRapierContext } from '../composables/useRapier'
import { createRigidBody } from '../utils/rigid-body.util'
import { createCollider, createCollidersFromChildren } from '../utils/collider.util'
import { MATRIX_ZERO, QUATERNION_ZERO, VECTOR_ZERO } from '../constants/object.constant'
import type { CreateRigidBodyReturnType, RigidBodyProps } from '../types/rigid-body.type'
import type { CreateColliderReturnType } from '../types/collider.type'
import { createRigidBody } from '../utils/rigid-body'
import { createCollider, createCollidersFromChildren } from '../utils/collider'
import { MATRIX_ZERO, QUATERNION_ZERO, VECTOR_ZERO } from '../constants/object'
import type { CreateRigidBodyReturnType, RigidBodyProps } from '../types/rigid-body'
import type { CreateColliderReturnType } from '../types/collider'
const props = withDefaults(defineProps<Partial<RigidBodyProps>>(), {
type: 'dynamic',
Expand All @@ -23,7 +23,7 @@ const parentObject = shallowRef<TresObject>()
const rigidBodyInfos = shallowRef<CreateRigidBodyReturnType[]>()
const colliderInfos = shallowRef<CreateColliderReturnType[]>()
watch(parentObject, (object) => {
watch(parentObject, (object?: TresObject) => {
if (!object) { return }
if (props.instanced) {
Expand Down Expand Up @@ -120,7 +120,7 @@ onBeforeRender(() => {
return
}
rigidBodyInfos.value.forEach((item) => {
rigidBodyInfos.value.forEach((item: CreateRigidBodyReturnType) => {
const position = item.rigidBody.translation()
item.object.position.set(position.x, position.y, position.z)
Expand Down
4 changes: 2 additions & 2 deletions src/composables/useRapier.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { inject, provide } from 'vue'

import { GRAVITY } from '../constants/physics.constant'
import type { RapierContext } from '../types/rapier.type'
import { GRAVITY } from '../constants/physics'
import type { RapierContext } from '../types/rapier'

/**
* @description Provides the `RapierContext` provider.
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/core/injectionKeys.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { InjectionKey, ShallowRef } from 'vue'

import type { InjectableRapierContext } from '../types/rapier.type'
import type { InjectableRapierContext } from '../types/rapier'

export const rapierInjectionKey: InjectionKey<
ShallowRef<InjectableRapierContext | null>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/types/rigid-body.type.ts → src/types/rigid-body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { TresObject } from '@tresjs/core'
import type { RigidBody, RigidBodyDesc, World } from '@dimforge/rapier3d-compat'
import type { InstancedMesh } from 'three'

import type { ColliderShape } from './collider.type'
import type { ColliderShape } from './collider'

/** @description Tres Rapier supported `RigidBody` types. */
export type RigidBodyType =
Expand Down
4 changes: 2 additions & 2 deletions src/utils/collider.util.ts → src/utils/collider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { ColliderDesc } from '@dimforge/rapier3d-compat'
import { mergeVertices } from 'three/examples/jsm/utils/BufferGeometryUtils.js'
import type { TresObject } from '@tresjs/core'

import { VECTOR_ZERO } from '../constants/object.constant'
import { VECTOR_ZERO } from '../constants/object'
import type {
CreateColliderDescProps,
CreateColliderProps,
CreateColliderReturnType,
CreateCollidersFromChildrenProps,
} from '../types/collider.type'
} from '../types/collider'

/**
* @description Create a {@link ColliderDesc} shape based on the given
Expand Down
2 changes: 1 addition & 1 deletion src/utils/rigid-body.util.ts → src/utils/rigid-body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
CreateRigidBodyDescProps,
CreateRigidBodyProps,
CreateRigidBodyReturnType,
} from '../types/rigid-body.type'
} from '../types/rigid-body'

/**
* @description Create a {@link RigidBodyDesc} based on the given
Expand Down

0 comments on commit f483b4f

Please sign in to comment.