EdgeEnd() public method

エッジ伸ばし終了
public EdgeEnd ( uDraggableNode node, ConnectBox end ) : void
node uDraggableNode
end ConnectBox
return void
Example #1
0
        /// <summary>
        /// 更新
        /// </summary>
        public override void OnUpdate()
        {
            ConnectBox near = null;

            {
                foreach (var box in connectBoxList)
                {
                    if (box.boxRect.Overlaps(parentWindow.mouseData.rect) && windowRect.Overlaps(parentWindow.mouseData.rect))
                    {
                        if (near == null ||
                            (near.boxRect.center - parentWindow.mouseData.rect.center).magnitude >=
                            (box.boxRect.center - parentWindow.mouseData.rect.center).magnitude)
                        {
                            box.active = true;
                            if (near != null)
                            {
                                // todo:ホントは遠い方をOFFにしたいけどうまくいかないので一旦。。。
                                box.active = false;
                            }
                            near = box;
                        }
                    }
                    else
                    {
                        box.active = false;
                    }
                }
            }


            if (parentWindow.Grid.m_GridZoomRate > 0.4f)
            {
                // エッジ生成
                if (parentWindow.mouseData.IsDown(MouseButton.Left))
                {
                    if (near != null)
                    {
                        if (parentWindow.ActiveEdge == null)
                        {
                            parentWindow.EdgeStart(this, near);
                        }
                        else
                        {
                            parentWindow.EdgeEnd(this, near);
                        }
                    }
                }
            }



            // グリッド移動
            if (parentWindow.mouseData.IsDrag(MouseButton.Middle))
            {
                windowRect.position += parentWindow.mouseData.delta;
            }
            // ズーム

            Vector2 gridPos = (windowRect.position - parentWindow.Grid.GridZoomCenterPoint) / parentWindow.Grid.preGridSize;

            if (parentWindow.mouseData.IsScroll())
            {
                // ズーム率1.0のサイズにズーム率かけてサイズ算出
                windowRect.width  = realWindowRect.width * parentWindow.Grid.m_GridZoomRate;
                windowRect.height = realWindowRect.height * parentWindow.Grid.m_GridZoomRate;

                //Debug.Log("pre : " + windowRect.position.ToString());
                // ズーム無しの時の位置
                realWindowRect.position = parentWindow.Grid.GridZoomCenterPoint + GridDrawer.GRID_INTERVAL * gridPos;

                // ズーム後の位置
                windowRect.position = parentWindow.Grid.GridZoomCenterPoint + parentWindow.Grid.gridSize * gridPos;
                //Debug.Log("post : " + windowRect.position.ToString());
            }
        }