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 { Camera, Scene, WebGLRenderer } from 'three'
|
||||||
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer'
|
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer'
|
||||||
import { defineComponent, InjectionKey, PropType } from 'vue'
|
import { defineComponent, InjectionKey, PropType } from 'vue'
|
||||||
|
import { PointerPublicConfigInterface } from './usePointer'
|
||||||
import useThree, { SizeInterface, ThreeConfigInterface, ThreeInterface } from './useThree'
|
import useThree, { SizeInterface, ThreeConfigInterface, ThreeInterface } from './useThree'
|
||||||
|
|
||||||
type CallbackType<T> = (event: T) => void
|
type CallbackType<T> = (event: T) => void
|
||||||
@ -94,9 +95,9 @@ export default defineComponent({
|
|||||||
antialias: Boolean,
|
antialias: Boolean,
|
||||||
alpha: Boolean,
|
alpha: Boolean,
|
||||||
autoClear: { type: Boolean, default: true },
|
autoClear: { type: Boolean, default: true },
|
||||||
orbitCtrl: { type: [Boolean, Object], default: false },
|
orbitCtrl: { type: [Boolean, Object] as PropType<boolean | Record<string, unknown>>, default: false },
|
||||||
pointer: { type: [Boolean, Object], default: false },
|
pointer: { type: [Boolean, Object] as PropType<boolean | PointerPublicConfigInterface>, default: false },
|
||||||
resize: { type: [Boolean, String], default: false },
|
resize: { type: [Boolean, String] as PropType<boolean | string>, default: false },
|
||||||
shadow: Boolean,
|
shadow: Boolean,
|
||||||
width: String,
|
width: String,
|
||||||
height: String,
|
height: String,
|
||||||
|
@ -20,10 +20,7 @@ export type PointerCallbackType = (e: PointerEventInterface) => void
|
|||||||
export type PointerIntersectCallbackType = (e: PointerIntersectEventInterface) => void
|
export type PointerIntersectCallbackType = (e: PointerIntersectEventInterface) => void
|
||||||
export type IntersectObject = Mesh | InstancedMesh
|
export type IntersectObject = Mesh | InstancedMesh
|
||||||
|
|
||||||
export interface PointerConfigInterface {
|
export interface PointerPublicConfigInterface {
|
||||||
camera: Camera
|
|
||||||
domElement: HTMLCanvasElement
|
|
||||||
intersectObjects: IntersectObject[]
|
|
||||||
intersectMode?: 'frame'
|
intersectMode?: 'frame'
|
||||||
touch?: boolean
|
touch?: boolean
|
||||||
resetOnEnd?: boolean
|
resetOnEnd?: boolean
|
||||||
@ -40,6 +37,12 @@ export interface PointerConfigInterface {
|
|||||||
onIntersectClick?: PointerIntersectCallbackType
|
onIntersectClick?: PointerIntersectCallbackType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface PointerConfigInterface extends PointerPublicConfigInterface {
|
||||||
|
camera: Camera
|
||||||
|
domElement: HTMLCanvasElement
|
||||||
|
intersectObjects: IntersectObject[]
|
||||||
|
}
|
||||||
|
|
||||||
export interface PointerInterface {
|
export interface PointerInterface {
|
||||||
position: Vector2
|
position: Vector2
|
||||||
positionN: Vector2
|
positionN: Vector2
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Camera, OrthographicCamera, PerspectiveCamera, Scene, WebGLRenderer } from 'three'
|
import { Camera, OrthographicCamera, PerspectiveCamera, Scene, WebGLRenderer } from 'three'
|
||||||
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js'
|
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js'
|
||||||
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.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 {
|
export interface SizeInterface {
|
||||||
width: number
|
width: number
|
||||||
@ -17,7 +17,7 @@ export interface ThreeConfigInterface {
|
|||||||
alpha: boolean
|
alpha: boolean
|
||||||
autoClear: boolean
|
autoClear: boolean
|
||||||
orbitCtrl: boolean | Record<string, unknown>
|
orbitCtrl: boolean | Record<string, unknown>
|
||||||
pointer: boolean | PointerConfigInterface
|
pointer: boolean | PointerPublicConfigInterface
|
||||||
resize: boolean | string
|
resize: boolean | string
|
||||||
width?: number
|
width?: number
|
||||||
height?: number
|
height?: number
|
||||||
|
Loading…
Reference in New Issue
Block a user