import * as THREE from "three" ; import { MapObjectAdapter } from "./MapObjectAdapter" ; function intersectObject ( object , raycaster , intersects , recursive ? ) { if ( object . layers . test ( raycaster . layers ) && object . visible ) { const mapObjectAdapter = MapObjectAdapter . get ( object ) ; if ( ! mapObjectAdapter || mapObjectAdapter . isPickable ( ) ) { object . raycast ( raycaster , intersects ) ; } } if ( recursive === true ) { for ( const child of object . children ) { intersectObject ( child , raycaster , intersects , true ) ; } } } internal export class PickingRaycaster extends THREE . Raycaster { param canvasSize constructor ( readonly canvasSize ) { super ( ) ; } intersectObject ( object , recursive ? , optionalTarget ? ) { const intersects = optionalTarget ?? [ ] ; intersectObject ( object , this , intersects , recursive ) ; return intersects ; } intersectObjects ( objects , recursive ? , optionalTarget ? ) { const intersects = optionalTarget ?? [ ] ; for ( const object of objects ) { intersectObject ( object , this , intersects , recursive ) ; } return intersects ; } }