@@ -3,16 +3,15 @@ import { useCallback, useEffect, useRef, useState } from "react"
33import * as THREE from "three"
44import type MirabufSceneObject from "@/mirabuf/MirabufSceneObject"
55import EventSystem from "@/systems/EventSystem.ts"
6- import { PAUSE_REF_ASSEMBLY_CONFIG } from "@/systems/physics/PhysicsTypes"
76import PreferencesSystem from "@/systems/preferences/PreferencesSystem"
87import type { CameraLook , CameraPoint } from "@/systems/preferences/PreferenceTypes"
98import type GizmoSceneObject from "@/systems/scene/GizmoSceneObject"
10- import World from "@/systems/World"
119import Label from "@/ui/components/Label"
1210import ScrollView from "@/ui/components/ScrollView"
1311import { AddButton , DeleteButton , EditButton } from "@/ui/components/StyledComponents"
1412import TransformGizmoControl from "@/ui/components/TransformGizmoControl"
1513import type { ConfigurationSubpanelComponent } from "@/panels/configuring/assembly-config/ConfigTypes.ts"
14+ import { useHoldPhysicsPause } from "@/util/ReactHooks.ts"
1615
1716const RAD_TO_DEG = 180 / Math . PI
1817const DEG_TO_RAD = Math . PI / 180
@@ -48,12 +47,10 @@ const ListView: React.FC<ListViewProps> = ({ selectedField, points, onChange, on
4847 useEffect ( ( ) => EventSystem . listen ( "ConfigurationSavedEvent" , saveEvent ) , [ saveEvent ] )
4948 useEffect ( ( ) => {
5049 persist ( points , selectedField )
51- World . physicsSystem . holdPause ( PAUSE_REF_ASSEMBLY_CONFIG )
52- return ( ) => {
53- World . physicsSystem . releasePause ( PAUSE_REF_ASSEMBLY_CONFIG )
54- }
5550 } , [ selectedField , points ] )
5651
52+ useHoldPhysicsPause ( )
53+
5754 return (
5855 < >
5956 { points . length > 0 ? (
@@ -134,12 +131,7 @@ const EditView: React.FC<EditViewProps> = ({ selectedField, point, onSave }) =>
134131 } , [ selectedField , point . pos , lookType , name , yawDeg , pitchDeg ] )
135132
136133 useEffect ( ( ) => EventSystem . listen ( "ConfigurationSavedEvent" , ( ) => onSave ( buildPoint ( ) ) ) , [ buildPoint , onSave ] )
137- useEffect ( ( ) => {
138- World . physicsSystem . holdPause ( PAUSE_REF_ASSEMBLY_CONFIG )
139- return ( ) => {
140- World . physicsSystem . releasePause ( PAUSE_REF_ASSEMBLY_CONFIG )
141- }
142- } , [ ] )
134+ useHoldPhysicsPause ( )
143135
144136 return (
145137 < Stack gap = { 2 } className = "bg-background-secondary rounded-md p-2" >
0 commit comments