diff --git a/src/core/Renderer.ts b/src/core/Renderer.ts index cdc1504..2a42816 100644 --- a/src/core/Renderer.ts +++ b/src/core/Renderer.ts @@ -2,6 +2,7 @@ import { Camera, Scene, WebGLRenderer } from 'three' import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer' import { defineComponent, InjectionKey, PropType } from 'vue' +import { PointerPublicConfigInterface } from './usePointer' import useThree, { SizeInterface, ThreeConfigInterface, ThreeInterface } from './useThree' type CallbackType = (event: T) => void @@ -94,9 +95,9 @@ export default defineComponent({ antialias: Boolean, alpha: Boolean, autoClear: { type: Boolean, default: true }, - orbitCtrl: { type: [Boolean, Object], default: false }, - pointer: { type: [Boolean, Object], default: false }, - resize: { type: [Boolean, String], default: false }, + orbitCtrl: { type: [Boolean, Object] as PropType>, default: false }, + pointer: { type: [Boolean, Object] as PropType, default: false }, + resize: { type: [Boolean, String] as PropType, default: false }, shadow: Boolean, width: String, height: String, diff --git a/src/core/usePointer.ts b/src/core/usePointer.ts index 5503819..35d8e66 100644 --- a/src/core/usePointer.ts +++ b/src/core/usePointer.ts @@ -20,10 +20,7 @@ export type PointerCallbackType = (e: PointerEventInterface) => void export type PointerIntersectCallbackType = (e: PointerIntersectEventInterface) => void export type IntersectObject = Mesh | InstancedMesh -export interface PointerConfigInterface { - camera: Camera - domElement: HTMLCanvasElement - intersectObjects: IntersectObject[] +export interface PointerPublicConfigInterface { intersectMode?: 'frame' touch?: boolean resetOnEnd?: boolean @@ -40,6 +37,12 @@ export interface PointerConfigInterface { onIntersectClick?: PointerIntersectCallbackType } +export interface PointerConfigInterface extends PointerPublicConfigInterface { + camera: Camera + domElement: HTMLCanvasElement + intersectObjects: IntersectObject[] +} + export interface PointerInterface { position: Vector2 positionN: Vector2 diff --git a/src/core/useThree.ts b/src/core/useThree.ts index 58d0d45..4e21b61 100644 --- a/src/core/useThree.ts +++ b/src/core/useThree.ts @@ -1,7 +1,7 @@ import { Camera, OrthographicCamera, PerspectiveCamera, Scene, WebGLRenderer } from 'three' import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js' import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js' -import usePointer, { IntersectObject, PointerConfigInterface, PointerInterface } from './usePointer' +import usePointer, { IntersectObject, PointerConfigInterface, PointerPublicConfigInterface, PointerInterface } from './usePointer' export interface SizeInterface { width: number @@ -17,7 +17,7 @@ export interface ThreeConfigInterface { alpha: boolean autoClear: boolean orbitCtrl: boolean | Record - pointer: boolean | PointerConfigInterface + pointer: boolean | PointerPublicConfigInterface resize: boolean | string width?: number height?: number