/// <summary> /// Add a Vector to the VectorLines list. /// Each vector has a tooltip and MouseEnter/MouseLeave events /// </summary> /// <param name="x"></param> /// <param name="y"></param> public void AddVector(double x, double y) { DWVector vector = VectorMath.GetNewVectorLocation(IHat, JHat, x, y); SolidColorBrush color = PickRandomColor(); DWLine vectorLine = new DWLine ( x, y, LineType.VECTOR, new Line { Stroke = color, X1 = CanvasXOrigin, Y1 = CanvasYOrigin, X2 = CanvasXOrigin + (vector.X * UnitLength), Y2 = CanvasYOrigin - (vector.Y * UnitLength) }, color ); vectorLine.Line.ToolTip = $"X: {vectorLine.X}\nY: {vectorLine.Y}"; vectorLine.Line.MouseEnter += MouseEnterVectorHighlight; vectorLine.Line.MouseLeave += MouseLeaveVectorHighlight; VectorLines.Add(vectorLine); }
public IEnumerator StartTraceLoop() { lineRenderer = GetComponent <LineRenderer>(); int count = 0; Finger myFinger = GetPointerFinger(); traceLoop = true; //Vector previousValue = myFinger.TipPosition; while (true) { //pos1 = transform.TransformPoint (previousValue.ToUnityScaled()); pos = transform.TransformPoint(myFinger.TipPosition.ToUnityScaled()); // LineDrawer (count, pos); VectorLines vectors = new VectorLines(); List <Vector2> vectorList = new List <Vector2>(); Vector2 vector = new Vector2(1.0f, 2.0f); vectorList.Add(vector); List <List <Vector2> > list = new List <List <Vector2> >(); list.Add(vectorList); list.Add(vectorList); list.Add(vectorList); list.Add(vectorList); vectors.InitializeLines(list); vectors.UpdateLines(list); //Camera cam = GetComponent<Camera>(); //Debug.DrawLine (pos1, pos2); //previousValue = myFinger.TipPosition; count++; Debug.Log(GetPointerFinger().TipPosition); if (myFinger.Id != GetPointerFinger().Id) { Debug.Log("Loop broke"); traceLoop = false; break; } yield return(null); /*if(Gesture.GestureType.TYPESCREENTAP) { * break; * } else { * if() { * * } * }*/ } }
void Awake() { cam = Camera.main; Instance = this; CreateLineMaterial(); }