public override void OnDataChanged() { if (presenter == null) { return; } // propagate selection but why? foreach (var child in this) { var graphElement = child as GraphElement; if (graphElement != null) { GraphElementPresenter childPresenter = graphElement.presenter; if (childPresenter != null) { childPresenter.selected = presenter.selected; } } } capabilities = m_Presenter.capabilities; selected = presenter.selected; SetPosition(presenter.position); }
public override void DoRepaint() { GraphView graphView = this.graphView; VisualElement contentViewContainer = graphView.contentViewContainer; Matrix4x4 matrix = graphView.viewTransform.matrix; Vector2 vector = new Vector2(matrix.m00, matrix.m11); float num = base.parent.layout.width / vector.x; float num2 = base.parent.layout.height / vector.y; if (Mathf.Abs(num - this.m_PreviousContainerWidth) > Mathf.Epsilon || Mathf.Abs(num2 - this.m_PreviousContainerHeight) > Mathf.Epsilon) { this.m_PreviousContainerWidth = num; this.m_PreviousContainerHeight = num2; this.Resize(); } this.CalculateRects(contentViewContainer); base.DoRepaint(); Color color = Handles.color; graphView.graphElements.ForEach(delegate(GraphElement elem) { if (!(elem is Edge)) { Rect rect = this.CalculateElementRect(elem); Handles.color = elem.elementTypeColor; MiniMap.s_CachedRect[0].Set(rect.xMin, rect.yMin, 0f); MiniMap.s_CachedRect[1].Set(rect.xMax, rect.yMin, 0f); MiniMap.s_CachedRect[2].Set(rect.xMax, rect.yMax, 0f); MiniMap.s_CachedRect[3].Set(rect.xMin, rect.yMax, 0f); Handles.DrawSolidRectangleWithOutline(MiniMap.s_CachedRect, elem.elementTypeColor, elem.elementTypeColor); if (elem.dependsOnPresenter) { GraphElementPresenter presenter = elem.GetPresenter <GraphElementPresenter>(); if (presenter != null && presenter.selected) { this.DrawRectangleOutline(rect, this.m_SelectedChildrenColor); } } else if (elem.selected) { this.DrawRectangleOutline(rect, this.m_SelectedChildrenColor); } } }); this.DrawRectangleOutline(this.m_ViewportRect, this.m_ViewportColor); Handles.color = color; }
public override void OnDataChanged() { if (!(this.presenter == null)) { foreach (VisualElement current in this) { GraphElement graphElement = current as GraphElement; if (graphElement != null) { GraphElementPresenter presenter = graphElement.presenter; if (presenter != null) { presenter.selected = this.presenter.selected; } } } this.capabilities = this.m_Presenter.capabilities; this.selected = this.presenter.selected; this.SetPosition(this.presenter.position); } }
public override void OnDataChanged() { GraphElementPresenter presenter = base.GetPresenter <GraphElementPresenter>(); this.m_Text.text = "Fallback for " + presenter.GetType() + ". No GraphElement registered for this type in this view."; }
public void RemoveTempElement(GraphElementPresenter element) { element.OnRemoveFromGraph(); this.m_TempElements.Remove(element); }
public void AddTempElement(GraphElementPresenter element) { this.m_TempElements.Add(element); }
public virtual void RemoveElement(GraphElementPresenter element) { element.OnRemoveFromGraph(); this.m_Elements.Remove(element); }
public virtual void AddElement(GraphElementPresenter element) { this.m_Elements.Add(element); }