Example #1
0
        public IEnumerator ResizingGraphElementExecutesElementResizedDelegate()
        {
            bool elementResized = false;

            graphView.elementResized += elements => elementResized = true;

            var graphElement = new TestGraphElement();

            graphElement.SetPosition(new Rect(50, 50, 50, 50));
            graphElement.style.width   = 50;
            graphElement.style.height  = 50;
            graphElement.capabilities |= Capabilities.Resizable;
            graphView.AddElement(graphElement);
            yield return(null);

            var size = graphElement.worldBound.size;
            var resizeElementPosition = graphElement.worldBound.center + size / 2 - new Vector2(5, 15);

            helpers.MouseDownEvent(resizeElementPosition);
            yield return(null);

            helpers.MouseDragEvent(resizeElementPosition, resizeElementPosition + new Vector2(10, 10));
            yield return(null);

            helpers.MouseUpEvent(resizeElementPosition + new Vector2(10, 10));
            yield return(null);

            Assert.IsTrue(elementResized);
            yield return(null);
        }
        public override void SetUp()
        {
            base.SetUp();

            m_Element1 = new TestGraphElement();
            m_Element1.SetPosition(k_Element1Position);
            m_Element1.style.width   = k_Element1Position.width;
            m_Element1.style.height  = k_Element1Position.height;
            m_Element1.capabilities |= Capabilities.Resizable;
            graphView.AddElement(m_Element1);

            m_Element2 = new TestGraphElement();
            m_Element2.SetPosition(k_Element2Position);
            m_Element2.style.width   = k_Element2Position.width;
            m_Element2.style.height  = k_Element2Position.height;
            m_Element2.capabilities |= Capabilities.Resizable;
            graphView.AddElement(m_Element2);
        }