Skip to content

Commit

Permalink
fix: added controls and extend to state context (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarosabu authored Jul 29, 2023
1 parent 3e815f7 commit c2540a5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/composables/useTresContextProvider/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { toValue, useElementSize, useWindowSize } from '@vueuse/core';
import { inject, provide, readonly, shallowRef, computed } from 'vue';
import { inject, provide, readonly, shallowRef, computed, ref } from 'vue';
import { useCamera } from '../useCamera';
import { Camera, Raycaster, Scene, WebGLRenderer } from 'three';
import { Camera, EventDispatcher, Raycaster, Scene, WebGLRenderer } from 'three';
import { UseRendererOptions, useRenderer } from '../useRenderer';
import { extend } from '../../core/catalogue';

import type { ComputedRef, DeepReadonly, MaybeRef, MaybeRefOrGetter, Ref, ShallowRef } from 'vue';

Expand All @@ -12,6 +13,8 @@ export type TresContext = {
cameras: DeepReadonly<Ref<Camera[]>>;
renderer: ShallowRef<WebGLRenderer>
raycaster: ShallowRef<Raycaster>
controls: Ref<(EventDispatcher & { enabled: boolean }) | null>
extend: (objects: any) => void
addCamera: (camera: Camera) => void;
removeCamera: (camera: Camera) => void
setCameraActive: (cameraOrUuid: Camera | string) => void;
Expand Down Expand Up @@ -75,6 +78,8 @@ export function useTresContextProvider({
cameras: readonly(cameras),
renderer,
raycaster: shallowRef(new Raycaster()),
controls: ref(null),
extend,
addCamera,
removeCamera,
setCameraActive,
Expand Down

0 comments on commit c2540a5

Please sign in to comment.