Skip to content
Snippets Groups Projects
Commit 13755f40 authored by John Schihada's avatar John Schihada
Browse files

Fixed a Line-/Angle-Preview-Bug

parent 12c2135b
No related branches found
No related tags found
No related merge requests found
...@@ -106,6 +106,8 @@ public void OnMouseOverFactEnd(Transform selection) ...@@ -106,6 +106,8 @@ public void OnMouseOverFactEnd(Transform selection)
public void ActivateLineDrawing(Fact startFact) public void ActivateLineDrawing(Fact startFact)
{ {
this.lineRenderer.positionCount = 2;
lineRenderer.startWidth = 0.095f; lineRenderer.startWidth = 0.095f;
lineRenderer.endWidth = 0.095f; lineRenderer.endWidth = 0.095f;
//Set LineDrawing activated //Set LineDrawing activated
...@@ -130,17 +132,16 @@ public void UpdateLineDrawing(Vector3 currentPosition) ...@@ -130,17 +132,16 @@ public void UpdateLineDrawing(Vector3 currentPosition)
//Deactivate LineDrawing so that no Line gets drawn when Cursor changes //Deactivate LineDrawing so that no Line gets drawn when Cursor changes
public void DeactivateLineDrawing(Fact startFact) public void DeactivateLineDrawing(Fact startFact)
{ {
//Reset the first points this.lineRenderer.positionCount = 0;
this.lineRenderer.SetPosition(0, Vector3.zero); this.linePositions = new List<Vector3>();
this.lineRenderer.SetPosition(1, Vector3.zero);
if (linePositions.Count > 0)
this.linePositions.Clear();
this.lineDrawingActivated = false; this.lineDrawingActivated = false;
} }
//Expect a LineFact here, so that it's possible to change between two possible StartPoints //Expect a LineFact here, so that it's possible to change between two possible StartPoints
public void ActivateCurveDrawing(Fact startFact) public void ActivateCurveDrawing(Fact startFact)
{ {
this.lineRenderer.positionCount = curveDrawingVertexCount;
lineRenderer.startWidth = 0.05f; lineRenderer.startWidth = 0.05f;
lineRenderer.endWidth = 0.05f; lineRenderer.endWidth = 0.05f;
...@@ -194,13 +195,9 @@ public void UpdateCurveDrawing(Vector3 currentPosition) ...@@ -194,13 +195,9 @@ public void UpdateCurveDrawing(Vector3 currentPosition)
public void DeactivateCurveDrawing(Fact startFact) public void DeactivateCurveDrawing(Fact startFact)
{ {
for (int i = 0; i < linePositions.Count; i++) this.lineRenderer.positionCount = 0;
{ this.linePositions = new List<Vector3>();
this.lineRenderer.SetPosition(i, Vector3.zero);
}
if (linePositions.Count > 0)
this.linePositions.Clear();
this.curveDrawingActivated = false; this.curveDrawingActivated = false;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment