Skip to content

Commit 07d8167

Browse files
authored
Merge pull request #20375 from gkjohnson/patch-2
LineSegements2: Add a "threshold" Raycaster param
2 parents 66b9fa3 + 706a375 commit 07d8167

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

examples/js/lines/LineSegments2.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,16 @@ THREE.LineSegments2.prototype = Object.assign( Object.create( THREE.Mesh.prototy
7070

7171
}
7272

73+
var threshold = ( raycaster.params.Line2 !== undefined ) ? raycaster.params.Line2.threshold || 0 : 0;
74+
7375
var ray = raycaster.ray;
7476
var camera = raycaster.camera;
7577
var projectionMatrix = camera.projectionMatrix;
7678

7779
var geometry = this.geometry;
7880
var material = this.material;
7981
var resolution = material.resolution;
80-
var lineWidth = material.linewidth;
82+
var lineWidth = material.linewidth + threshold;
8183

8284
var instanceStart = geometry.attributes.instanceStart;
8385
var instanceEnd = geometry.attributes.instanceEnd;

examples/jsm/lines/LineSegments2.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,16 @@ LineSegments2.prototype = Object.assign( Object.create( Mesh.prototype ), {
8181

8282
}
8383

84+
var threshold = ( raycaster.params.Line2 !== undefined ) ? raycaster.params.Line2.threshold || 0 : 0;
85+
8486
var ray = raycaster.ray;
8587
var camera = raycaster.camera;
8688
var projectionMatrix = camera.projectionMatrix;
8789

8890
var geometry = this.geometry;
8991
var material = this.material;
9092
var resolution = material.resolution;
91-
var lineWidth = material.linewidth;
93+
var lineWidth = material.linewidth + threshold;
9294

9395
var instanceStart = geometry.attributes.instanceStart;
9496
var instanceEnd = geometry.attributes.instanceEnd;

0 commit comments

Comments
 (0)