public void Draw(float width, float height, Vector2 scrollPosition, float scale) { DiagramDrawer.IsEditingField = false; if (Drawer == null) { InvertApplication.Log("DRAWER IS NULL"); return; } var diagramRect = new Rect(); if (DrawToolbar) { var toolbarTopRect = new Rect(0, 0, width, 18); var tabsRect = new Rect(0, toolbarTopRect.height, width, 31); var breadCrumbsRect = new Rect(0, tabsRect.y + tabsRect.height, width, 30); diagramRect = new Rect(0f, breadCrumbsRect.y + breadCrumbsRect.height, width, height - ((toolbarTopRect.height * 2)) - breadCrumbsRect.height - 31); var toolbarBottomRect = new Rect(0f, diagramRect.y + diagramRect.height, width, toolbarTopRect.height); List<DesignerWindowModalContent> modalItems = new List<DesignerWindowModalContent>(); Signal<IQueryDesignerWindowModalContent>(_ => _.QueryDesignerWindowModalContent(modalItems)); List<DesignerWindowOverlayContent> overlayItems = new List<DesignerWindowOverlayContent>(); Signal<IQueryDesignerWindowOverlayContent>(_ => _.QueryDesignerWindowOverlayContent(overlayItems)); //Disable diagram input if any modal content presents or if mouse is over overlay content _shouldProcessInputFromDiagram = !modalItems.Any() && overlayItems.All(i => !i.Drawer.CalculateBounds(diagramRect).Contains(Event.current.mousePosition)); Drawer.DrawStretchBox(toolbarTopRect, CachedStyles.Toolbar, 0f); Drawer.DoToolbar(toolbarTopRect, this, ToolbarPosition.Left); //drawer.DoToolbar(toolbarTopRect, this, ToolbarPosition.Right); Drawer.DrawRect(tabsRect, InvertGraphEditor.Settings.GridLinesColor); //Drawer.DoTabs(Drawer,tabsRect, this); DiagramRect = diagramRect; /* * DRAW DIAGRAM * Using GUI.color hack to avoid transparent diagram on disabled input (Thanks Unity :( ) */ if (!_shouldProcessInputFromDiagram) Drawer.DisableInput(); if (DiagramDrawer != null) { DiagramDrawer.DrawTabs(Drawer, tabsRect); DiagramDrawer.DrawBreadcrumbs(Drawer, breadCrumbsRect.y); } var fpsCounterRect = tabsRect.WithWidth(80).RightOf(tabsRect).Translate(-100,0); if (ShowFPS) { if ((DateTime.Now - _lastFpsUpdate).TotalMilliseconds > 1000) { _fpsShown = _framesLastSec; _lastFpsUpdate = DateTime.Now; _framesLastSec = 0; } else { _framesLastSec++; } Drawer.DrawLabel(fpsCounterRect, string.Format("FPS: {0}", _fpsShown), CachedStyles.WizardSubBoxTitleStyle); } Drawer.DrawRect(diagramRect, InvertGraphEditor.Settings.BackgroundColor); DiagramRect = diagramRect; DrawDiagram(Drawer, scrollPosition, scale, diagramRect); Drawer.EnableInput(); /* * DRAW OVERLAY CONTENT */ if (modalItems.Any()) Drawer.DisableInput(); foreach (var item in overlayItems) { var bounds = item.Drawer.CalculateBounds(diagramRect); var isMouseOver = bounds.Contains(Event.current.mousePosition); var colorCache = GUI.color; if (!isMouseOver && !item.DisableTransparency) GUI.color = new Color(colorCache.r, colorCache.g, colorCache.b, colorCache.a / 4); item.Drawer.Draw(bounds); GUI.color = colorCache; } Drawer.EnableInput(); /* * DRAW MODAL CONTENT */ if (modalItems.Any()) { var modalBackgroundRect = new Rect().Cover(breadCrumbsRect, tabsRect, diagramRect); var modalContentRect = new Rect().WithSize(800, 500).CenterInsideOf(modalBackgroundRect); var activeModal = modalItems.OrderBy(i => i.ZIndex).Last(); Drawer.DisableInput(); foreach (var source in modalItems.OrderBy(i => i.ZIndex).Except(new[] { activeModal })) { source.Drawer(modalContentRect); } Drawer.EnableInput(); Drawer.DrawRect(modalBackgroundRect, new Color(0, 0, 0, 0.8f)); activeModal.Drawer(modalContentRect); } DrawToolip(breadCrumbsRect); Drawer.DoToolbar(toolbarBottomRect, this, ToolbarPosition.BottomLeft); //drawer.DoToolbar(toolbarBottomRect, this, ToolbarPosition.BottomRight); } else { diagramRect = new Rect(0f, 0f, width, height); DiagramRect = diagramRect; DrawDiagram(Drawer, scrollPosition, scale, diagramRect); } InvertApplication.SignalEvent<IDesignerWindowEvents>(_ => _.AfterDrawDesignerWindow(new Rect(0, 0, width, height))); InvertApplication.SignalEvent<IDesignerWindowEvents>(_ => _.DrawComplete()); }