Skip to content

Commit 89a55ef

Browse files
committed
cleanup, intersect only with visible meshes
1 parent dfa1a18 commit 89a55ef

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

source/class/desk/THREE/Container.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,10 @@ qx.Class.define("desk.THREE.Container",
224224
* @return {Array} array of objects
225225
*/
226226
getMeshes : function() {
227-
var meshes = [];
227+
const meshes = [];
228228
if (!this.getScene()) return [];
229229
this.getScene().traverse(function(child) {
230-
if (child.userData.viewerProperties) {
230+
if (!child.isGroup && child.userData.viewerProperties) {
231231
meshes.push(child);
232232
}
233233
});
@@ -789,22 +789,19 @@ qx.Class.define("desk.THREE.Container",
789789
* @return {Array} array of intersections
790790
*/
791791
getIntersections : function (meshes) {
792-
var origin = this.getContentLocation();
793-
var x = this.__x - origin.left;
794-
var y = this.__y - origin.top;
792+
const origin = this.getContentLocation();
793+
const x = this.__x - origin.left;
794+
const y = this.__y - origin.top;
795795

796-
var elementSize = this.getInnerSize();
797-
var mouse = new THREE.Vector2();
796+
const elementSize = this.getInnerSize();
797+
const mouse = new THREE.Vector2();
798798
mouse.x = ( x / elementSize.width ) * 2 - 1;
799799
mouse.y = - ( y / elementSize.height ) * 2 + 1;
800800

801-
var raycaster = new THREE.Raycaster();
801+
const raycaster = new THREE.Raycaster();
802802
raycaster.setFromCamera(mouse, this.getCamera());
803803

804-
meshes = meshes || _.filter(this.getMeshes(), function (mesh) {
805-
return mesh.visible;
806-
});
807-
804+
meshes = meshes || this.getMeshes().filter( m => m.visible );
808805
if ( this.rayCasterParams ) raycaster.params = this.rayCasterParams;
809806
return raycaster.intersectObjects(meshes);
810807
},

0 commit comments

Comments
 (0)