|
@@ -1,7 +1,7 @@
|
|
|
<script lang="ts" setup>
|
|
|
import { Camera, Vector3 } from 'three'
|
|
|
import { OrbitControls } from 'three-stdlib'
|
|
|
-import { ref, watch, type Ref } from 'vue'
|
|
|
+import { ref, watch, watchEffect, unref, type Ref } from 'vue'
|
|
|
|
|
|
import { useCientos } from './useCientos'
|
|
|
|
|
@@ -18,12 +18,10 @@ const props = withDefaults(
|
|
|
},
|
|
|
)
|
|
|
|
|
|
-const { state, setState } = useCientos()
|
|
|
+const { state, setState, extend } = useCientos()
|
|
|
|
|
|
const controls = ref(null)
|
|
|
|
|
|
-const { extend } = useCientos()
|
|
|
-
|
|
|
extend({ OrbitControls })
|
|
|
|
|
|
watch(controls, value => {
|
|
@@ -39,7 +37,7 @@ watch(controls, value => {
|
|
|
<TresOrbitControls
|
|
|
v-if="state.camera && state.renderer"
|
|
|
ref="controls"
|
|
|
- :args="[state.camera, state.renderer?.domElement]"
|
|
|
+ :args="[unref(state.camera), state.renderer?.domElement]"
|
|
|
:enabling-dampling="enableDamping"
|
|
|
/>
|
|
|
</template>
|