Commit 713a013c authored by legoc's avatar legoc
Browse files

Do not display line segment in spy mode for energy lines

parent 44db1038
......@@ -119,22 +119,26 @@ class EnergyLine extends TrajectoryLine {
*/
updateLine() {
// Remove the line from the data group.
if (this._line !== null) {
this._dataGroup.remove(this._line.object3D);
// Destroy the line segment.
this._line.destroy();
}
// The line segment is not displayed in spy mode.
if (!mode.spyMode) {
// Calculate length of the segment. Applies the scale.
let length = this._end.clone().sub(this._start).length() * this.getEnergyScale();
// Remove the line from the data group.
if (this._line !== null) {
this._dataGroup.remove(this._line.object3D);
// Destroy the line segment.
this._line.destroy();
}
// Create a line segment for the line.
let segment = new LineSegment(new THREE.Vector3(0, 0, 0), new THREE.Vector3(0, 0, length), 0.5 / scale, this._lineMaterial);
this._line = segment;
// Calculate length of the segment. Applies the scale.
let length = this._end.clone().sub(this._start).length() * this.getEnergyScale();
// Add the line to the data group.
this._dataGroup.add(this._line.object3D);
// Create a line segment for the line.
let segment = new LineSegment(new THREE.Vector3(0, 0, 0), new THREE.Vector3(0, 0, length), 0.5 / scale, this._lineMaterial);
this._line = segment;
// Add the line to the data group.
this._dataGroup.add(this._line.object3D);
}
// Update the data.
this.updateDataGroup();
......@@ -158,7 +162,10 @@ class EnergyLine extends TrajectoryLine {
* Set line visibility.
*/
setVisibility(visibility) {
this._line.object3D.visible = visibility;
if (this._line !== null) {
this._line.object3D.visible = visibility;
}
this._dataGroup.visible = visibility;
}
......@@ -170,7 +177,9 @@ class EnergyLine extends TrajectoryLine {
this._parent.remove(this._group);
// Destroy the line segment.
this._line.destroy();
if (this._line !== null) {
this._line.destroy();
}
// Remove the spheres.
this.removeSpheres();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment