From e38e6996d5eb136bb9bf0a828547c2c9403aebd5 Mon Sep 17 00:00:00 2001 From: alvarosabu Date: Mon, 6 Mar 2023 22:54:07 +0100 Subject: [PATCH] feat(cientos): orbit controls typed --- packages/cientos/src/core/OrbitControls.vue | 60 ++++++++++++++++----- 1 file changed, 48 insertions(+), 12 deletions(-) diff --git a/packages/cientos/src/core/OrbitControls.vue b/packages/cientos/src/core/OrbitControls.vue index a275db71b..75a431bc0 100644 --- a/packages/cientos/src/core/OrbitControls.vue +++ b/packages/cientos/src/core/OrbitControls.vue @@ -5,18 +5,54 @@ import { ref, watch, unref, type Ref } from 'vue' import { useCientos } from './useCientos' -const props = withDefaults( - defineProps<{ - makeDefault?: boolean - camera?: Camera - domElement?: HTMLElement - target?: Ref - enableDamping?: boolean - }>(), - { - makeDefault: false, - }, -) +export interface OrbitControlsProps { + /** + * Whether to make this the default controls. + * + * @default false + * @type {boolean} + * @memberof OrbitControlsProps + * @see https://threejs.org/docs/#examples/en/controls/OrbitControls + */ + makeDefault?: boolean + /** + * The camera to control. + * + * @type {Camera} + * @memberof OrbitControlsProps + * @see https://threejs.org/docs/#examples/en/controls/OrbitControls + */ + camera?: Camera + /** + * The dom element to listen to. + * + * @type {HTMLElement} + * @memberof OrbitControlsProps + * @see https://threejs.org/docs/#examples/en/controls/OrbitControls + */ + domElement?: HTMLElement + /** + * The target to orbit around. + * + * @type {Ref} + * @memberof OrbitControlsProps + * @see https://threejs.org/docs/#examples/en/controls/OrbitControls + */ + target?: Ref + /** + * Whether to enable damping. + * + * @default false + * @type {boolean} + * @memberof OrbitControlsProps + * @see https://threejs.org/docs/#examples/en/controls/OrbitControls + */ + enableDamping?: boolean +} + +const props = withDefaults(defineProps(), { + makeDefault: false, +}) const { state, setState, extend } = useCientos()