private void DrawLine(Rect lineRect) { EGUI.DrawAreaLine(lineRect, Color.gray); Rect rulerRect = new Rect(lineRect.x, lineRect.y, lineRect.width, LINE_RULER_HEIGHT); EditorGUI.LabelField(rulerRect, GUIContent.none, EditorStyles.toolbar); DrawLineRuler(rulerRect); Rect gridRect = new Rect(lineRect.x, lineRect.y + LINE_RULER_HEIGHT, lineRect.width, lineRect.height - LINE_RULER_HEIGHT); DrawLineGrid(gridRect); if (Data != null) { DrawTrackline(gridRect); LineSetting setting = LineSetting.Setting; using (new GUILayout.AreaScope(gridRect)) { using (var scop = new UnityEditor.EditorGUILayout.ScrollViewScope(setting.ScrollPos)) { float scrollWith = Mathf.Max(Data.TimeLength * setting.WidthForSecond, gridRect.width); float scrollHeight = Mathf.Max(Data.Tracks.Count * setting.TracklineHeight, gridRect.height); GUILayout.Label("", GUILayout.Width(scrollWith), GUILayout.Height(scrollHeight - 20)); setting.ScrollPos = scop.scrollPosition; } } } }
public virtual void OnEditorGUI() { using (var scope = new UnityEditor.EditorGUILayout.ScrollViewScope(m_ScrollViewPos)) { using (new UnityEditor.EditorGUILayout.VerticalScope()) { for (int i = 0; i < m_DebugPanel.itemCount; ++i) { m_DebugPanel.GetDebugItem(i).handler.OnEditorGUI(); } } m_ScrollViewPos = scope.scrollPosition; } }
private void DrawScroll(Rect rect) { using (new GUILayout.AreaScope(rect)) { using (var scop = new UnityEditor.EditorGUILayout.ScrollViewScope(DrawerConfig.GroupScrollPos)) { float scrollWith = Mathf.Max(m_GroupData.Length * DrawerConfig.WidthForSecond, rect.width); float scrollHeight = Mathf.Max(m_GroupData.Tracks.Count * DrawerConfig.TrackLineHeight, rect.height); GUILayout.Label("", GUILayout.Width(scrollWith), GUILayout.Height(scrollHeight - 20)); DrawerConfig.GroupScrollPos = scop.scrollPosition; } } }