- Edit
- components/HelloWorld.vue to test HMR
-
- Check out - create-vue, the - official Vue + Vite starter -
-- Learn more about IDE Support for Vue in the - Vue Docs Scaling up Guide. -
-Click on the Vite and Vue logos to learn more
- - - diff --git a/src/components/Viewport.vue b/src/components/Viewport.vue index 3d62c00eb..63e4dee22 100644 --- a/src/components/Viewport.vue +++ b/src/components/Viewport.vue @@ -2,6 +2,14 @@ import { ref, watch, onMounted, onBeforeUnmount } from 'vue' import * as THREE from 'three' import { OrbitControls } from 'three/addons/controls/OrbitControls.js' +import { + HOME_POSITION, + HOME_TARGET, + VIEW_POSITIONS, + calculateFitDistance, + getViewUpVector, + type ViewPreset, +} from '../utils/camera' const props = withDefaults( defineProps<{ @@ -28,21 +36,6 @@ let gridHelper: THREE.GridHelper let axisHelper: THREE.AxesHelper let controls: OrbitControls -const HOME_POSITION = new THREE.Vector3(5, 5, 5) -const HOME_TARGET = new THREE.Vector3(0, 0, 0) -const VIEW_DISTANCE = 10 - -type ViewPreset = 'front' | 'back' | 'top' | 'bottom' | 'left' | 'right' - -const VIEW_POSITIONS: Record