public void Draw(EventStepData data, int index) { //GetRescale(); ManageData(data); Vector2 barPos = new Vector2(TimelineHelper.ConvertTimeToOverflowPixels(data.startTime, (int)overflow.x, time), TimelineHelper.ConvertTimeToOverflowPixels(data.startTime + data.duration, (int)overflow.x, time)); // Guarantee a minimum size for all zero-duration steps if (data.duration == 0f) { Vector2 minSize = barStyle.CalcSize(new GUIContent(data.type.ToString())); barPos.y = barPos.x + minSize.x + 4; } GUI.depth = 1; GUILayout.BeginArea(drawArea); //GUI.BeginScrollView(new Rect(0,0,drawArea.width,drawArea.height), scroll, new Rect(0,0,overflow.x,overflow.y)); GUIStyle useForBar = this.barStyle; Rect barRect = new Rect(barPos.x, index * barHeight + index, barPos.y - barPos.x, barHeight); if (barRect.x + barRect.width > this.drawArea.width) { barRect.x -= barRect.width; useForBar = this.occludedBarStyle; } GUI.Label(barRect, data.type.ToString(), useForBar); if (GUI.Button(barRect, "", labelStyle)) { EventStepDataWindow stepDataWindow; stepDataWindow = EditorWindow.GetWindow <EventStepDataWindow>(); stepDataWindow.Edit(this, data); } GUIContent calc = new GUIContent(data.startTime.ToString()); Vector2 size = GUI.skin.label.CalcSize(calc); GUI.Label(new Rect(barRect.x, barRect.y, size.x, size.y), calc, labelStyle); calc.text = (data.startTime + data.duration).ToString(); size = GUI.skin.label.CalcSize(calc); GUI.Label(new Rect((barRect.x + barRect.width) - size.x, (barRect.y + barRect.height) - size.y, size.x, size.y), calc, labelStyle); //GUI.EndScrollView(); GUILayout.EndArea(); }