three-render-objects
Advanced tools
Comparing version 1.21.1 to 1.22.0
@@ -247,7 +247,3 @@ 'use strict'; | ||
if (state.hoverDuringDrag || !state.isPointerDragging) { | ||
var raycaster = new three.Raycaster(); | ||
raycaster.params.Line.threshold = state.lineHoverPrecision; // set linePrecision | ||
raycaster.setFromCamera(state.pointerPos, state.camera); | ||
var intersects = raycaster.intersectObjects(state.objects, true).map(function (_ref) { | ||
var intersects = this.intersectingObjects(state.pointerPos.x, state.pointerPos.y).map(function (_ref) { | ||
var object = _ref.object; | ||
@@ -386,2 +382,9 @@ return object; | ||
}, | ||
intersectingObjects: function intersectingObjects(state, x, y) { | ||
var raycaster = new three.Raycaster(); | ||
raycaster.params.Line.threshold = state.lineHoverPrecision; // set linePrecision | ||
raycaster.setFromCamera(new three.Vector2(x, y), state.camera); | ||
return raycaster.intersectObjects(state.objects, true); | ||
}, | ||
renderer: function renderer(state) { | ||
@@ -388,0 +391,0 @@ return state.renderer; |
@@ -1,2 +0,2 @@ | ||
import { WebGLRendererParameters, Object3D, WebGLRenderer, Scene, Camera } from 'three'; | ||
import { WebGLRendererParameters, Object3D, WebGLRenderer, Scene, Camera, Intersection } from 'three'; | ||
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js'; | ||
@@ -74,2 +74,3 @@ | ||
getcreenCoords(x: number, y: number, z: number): { x: number, y: number; }; | ||
intersectingObjects(x: number, y: number): Intersection[]; | ||
} | ||
@@ -76,0 +77,0 @@ |
@@ -243,7 +243,3 @@ import { WebGLRenderer, Scene, PerspectiveCamera, Raycaster, TextureLoader, Vector2, Vector3, Box3, Color, Mesh, SphereGeometry, MeshBasicMaterial, BackSide, EventDispatcher, MOUSE, Quaternion, Spherical, Clock } from 'three'; | ||
if (state.hoverDuringDrag || !state.isPointerDragging) { | ||
var raycaster = new three.Raycaster(); | ||
raycaster.params.Line.threshold = state.lineHoverPrecision; // set linePrecision | ||
raycaster.setFromCamera(state.pointerPos, state.camera); | ||
var intersects = raycaster.intersectObjects(state.objects, true).map(function (_ref) { | ||
var intersects = this.intersectingObjects(state.pointerPos.x, state.pointerPos.y).map(function (_ref) { | ||
var object = _ref.object; | ||
@@ -382,2 +378,9 @@ return object; | ||
}, | ||
intersectingObjects: function intersectingObjects(state, x, y) { | ||
var raycaster = new three.Raycaster(); | ||
raycaster.params.Line.threshold = state.lineHoverPrecision; // set linePrecision | ||
raycaster.setFromCamera(new three.Vector2(x, y), state.camera); | ||
return raycaster.intersectObjects(state.objects, true); | ||
}, | ||
renderer: function renderer(state) { | ||
@@ -384,0 +387,0 @@ return state.renderer; |
{ | ||
"name": "three-render-objects", | ||
"version": "1.21.1", | ||
"version": "1.22.0", | ||
"description": "Easy way to render ThreeJS objects with built-in interaction defaults", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -102,2 +102,3 @@ three-render-objects | ||
| <b>getScreenCoords</b>(<i>x</i>, <i>y</i>, <i>z</i>) | Utility method to translate 3D coordinates to the viewport domain. Given a set of `x`,`y`,`z` coordinates, returns the current equivalent `{x, y}` in viewport coordinates. | | ||
| <b>intersectingObjects</b>(<i>x</i>, <i>y</i>) | Utility method to retrieve the list of objects under the line of sight of the given viewport coordinates. Returns an array of [intersectObject](https://threejs.org/docs/#api/en/core/Raycaster.intersectObject), sorted by distance (from closest to farthest). | | ||
@@ -104,0 +105,0 @@ [npm-img]: https://img.shields.io/npm/v/three-render-objects.svg |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5144120
37532
110