public bool MouseMove(MouseButtons button, PointF location, PointF revertPoint, PointF downPoint) { if (_studio.IsGrid) { revertPoint = Tool.GetGridPointF(revertPoint); } if (_state != CreateState.NotCreate) { _studio.Container.Cursor = Cursors.Cross; if (_isNodeCreate) { if (_nodeObject != null) { INodeEdit node = (INodeEdit)_nodeObject; int count = node.NodeDatas.Count; PointF lastPoint = node.NodeDatas[count - 2]; revertPoint = GetOrthoHoriorVert(lastPoint, revertPoint); node.MoveNode(revertPoint, count - 1); } } else { location = GetOrthoSquarePoint(downPoint, location); if (_state == CreateState.HasCreate) { _studio.DrawFrame(downPoint, location, FrameStyle.Thick, false); } } return(true); } return(false); }
public bool MouseDown(MouseButtons button, PointF location, PointF revertPoint) { if (_studio.IsGrid) { revertPoint = Tool.GetGridPointF(revertPoint); } if (_state == CreateState.BeginCreate) { _state = CreateState.HasCreate; if (_nodeObject != null) { End(); return(true); } if (_isNodeCreate) { _nodeObject = (IDrawVector)_studio.CreateDrawObj(_type); _nodeObject.Parant = _studio.Container; ((ObjName)_studio.NameManager).CreateName(_nodeObject); _studio.Objs.Add(_nodeObject); INodeEdit node = (INodeEdit)_nodeObject; node.IsNodeCreating = true; node.AddNode(revertPoint); node.AddNode(revertPoint); _nodeObject.LoadInitializationEvent(); } return(true); } if (_state == CreateState.HasCreate) { if (_isNodeCreate && _nodeObject != null) { INodeEdit node = (INodeEdit)_nodeObject; int count = node.NodeDatas.Count; PointF lastPoint = node.NodeDatas[count - 2]; revertPoint = GetOrthoHoriorVert(lastPoint, revertPoint); //预防在同一位置重复添加点 if (Point.Ceiling(lastPoint) == Point.Ceiling(revertPoint)) { return(true); } node.MoveNode(revertPoint, count - 1); node.AddNode(revertPoint); //添加点后创建成功,则直接结束 if (node.CreateFinish) { End(); return(true); } } return(true); } return(false); }