/// <summary> /// Draws a point list into a draw area. The difference between this and DrawGesture is that /// this method draws a gesture before it is saved as a gesture (hence, draw "point list"). /// </summary> /// <param name="points">Point list to draw</param> /// <param name="drawArea">Area to draw the list on</param> public static void DrawPointList(List <Point> points, Rect drawArea) { Handles.BeginGUI(); int currentStrokeID = 0; for (int i = 0; i < points.Count; i++) { Handles.color = LineColor; if (i != points.Count - 1) { if (currentStrokeID == points[i + 1].StrokeID) { GestureEditorUtility.DrawBezier( TranslateToDrawArea(points[i].Position, drawArea, true), TranslateToDrawArea(points[i + 1].Position, drawArea, true) ); } else { currentStrokeID++; } } } Handles.EndGUI(); }
/// <summary> /// Draws a gesture into a draw area /// </summary> /// <param name="g">Gesture to draw</param> /// <param name="drawArea">Area to draw the gesture on</param> public static void DrawGesture(Gesture g, Rect drawArea) { Handles.BeginGUI(); int currentStrokeID = 0; for (int i = 0; i < g.OriginalPoints.Length; i++) { Handles.color = LineColor; if (i != g.OriginalPoints.Length - 1) { if (currentStrokeID == g.OriginalPoints[i + 1].StrokeID) { GestureEditorUtility.DrawBezier( TranslateToDrawArea(g.OriginalPoints[i].Position, drawArea, true), TranslateToDrawArea(g.OriginalPoints[i + 1].Position, drawArea, true) ); } else { currentStrokeID++; } } } Handles.EndGUI(); }