/// <summary>
        /// Dispatches a <see cref="ReframeGraphViewCommand"/> to show all graph elements.
        /// </summary>
        /// <param name="self">The graph view.</param>
        public static void DispatchFrameAllCommand(this GraphView self)
        {
            var rectToFit = self.CalculateRectToFitAll(self.ContentViewContainer);

            self.CalculateFrameTransform(rectToFit, self.layout, GraphView.k_FrameBorder, out var frameTranslation, out var frameScaling);
            self.CommandDispatcher.Dispatch(new ReframeGraphViewCommand(frameTranslation, frameScaling));
        }
        internal void UpdateViewTransform(FindInGraphAdapter.FindSearcherItem item)
        {
            if (item == null)
            {
                return;
            }

            GraphElement elt = null;
            Vector3      frameTranslation;
            Vector3      frameScaling;

            if (ModelsToNodeMapping?.TryGetValue(item.Node, out elt) ?? false)
            {
                m_GraphView.ClearSelection();
                m_GraphView.AddToSelection(elt);

                Rect rect = elt.parent.ChangeCoordinatesTo(m_GraphView.contentViewContainer, elt.localBound);
                GraphView.CalculateFrameTransform(
                    rect, m_GraphView.layout, 30, out frameTranslation, out frameScaling
                    );
            }
            else
            {
                Debug.LogError("no ui mapping for " + item.Name);
                GraphView.CalculateFrameTransform(
                    new Rect(item.Node.ParentStackModel?.Position ?? item.Node.Position, Vector2.one),
                    m_GraphView.layout,
                    30,
                    out frameTranslation,
                    out frameScaling
                    );
            }

            m_GraphView.UpdateViewTransform(frameTranslation, frameScaling);
        }
        /// <summary>
        /// Dispatch a command to frame and optionally select a list of graph elements.
        /// </summary>
        /// <param name="self">The GraphView.</param>
        /// <param name="graphElements">The list of elements to frame and optionally select.</param>
        /// <param name="select">True if the elements should be selected. False if the selection should not change.</param>
        public static void DispatchFrameAndSelectElementsCommand(this GraphView self, bool select, IReadOnlyList <GraphElement> graphElements)
        {
            if (!graphElements.Any())
            {
                return;
            }

            var rectToFit = CalculateRectToFitElements(self, graphElements);

            self.CalculateFrameTransform(rectToFit, self.layout, GraphView.k_FrameBorder, out var frameTranslation, out var frameScaling);

            self.CommandDispatcher.Dispatch(new ReframeGraphViewCommand(frameTranslation, frameScaling,
                                                                        select ? graphElements.Select(e => e.Model).ToList() : null));
        }