mirror of
https://github.com/troisjs/trois.git
synced 2024-11-23 20:02:32 +08:00
pointer config prop ts
This commit is contained in:
parent
5562d5f496
commit
f50d66b733
@ -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<T> = (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<boolean | Record<string, unknown>>, default: false },
|
||||
pointer: { type: [Boolean, Object] as PropType<boolean | PointerPublicConfigInterface>, default: false },
|
||||
resize: { type: [Boolean, String] as PropType<boolean | string>, default: false },
|
||||
shadow: Boolean,
|
||||
width: String,
|
||||
height: String,
|
||||
|
@ -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
|
||||
|
@ -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<string, unknown>
|
||||
pointer: boolean | PointerConfigInterface
|
||||
pointer: boolean | PointerPublicConfigInterface
|
||||
resize: boolean | string
|
||||
width?: number
|
||||
height?: number
|
||||
|
Loading…
Reference in New Issue
Block a user