本文整理汇总了C#中Behaviac.Design.NodeViewData.CanBeDragged方法的典型用法代码示例。如果您正苦于以下问题:C# NodeViewData.CanBeDragged方法的具体用法?C# NodeViewData.CanBeDragged怎么用?C# NodeViewData.CanBeDragged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Behaviac.Design.NodeViewData
的用法示例。
在下文中一共展示了NodeViewData.CanBeDragged方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnMouseDown
/// <summary>
/// Handles when a mouse button was pressed.
/// </summary>
protected override void OnMouseDown(MouseEventArgs e) {
// the graph has not yet been dragged
_startMousePosition = e.Location;
_lastMousePosition = e.Location;
_objectDragType = ObjectDragTypes.kNone;
_dragAttachment = null;
_dragTargetAttachment = null;
_movedSubItem = null;
_fsmDragMode = FSMDragModes.kNone;
if (!_clipboardPasteMode) {
_currentNode = _rootNodeView.GetInsideNode(_lastMousePosition);
_dragTargetNode = null;
_movedNodeGraph = null;
_movedNode = null;
if (_currentNode != null) {
if (KeyCtrlIsDown || _currentNode.IsFSM || _currentNode.CanBeDragged() &&
(KeyShiftIsDown || _currentNode.Node.ParentCanAdoptChildren)) {
_objectDragType = ObjectDragTypes.kNode;
}
}
} else {
if (_currentNode == null) {
_currentNode = _rootNodeView.GetInsideNode(_lastMousePosition);
}
if (_dragTargetNode == null) {
_dragTargetNode = _currentNode;
}
}
if (e.Button == MouseButtons.Left && _currentNode != null) {
Debug.Check(_nodeLayoutManager != null);
NodeViewData.SubItem subItem = _currentNode.GetSubItem(_currentNode, _nodeLayoutManager.ViewToGraph(e.Location));
NodeViewData.SubItemAttachment attach = subItem as NodeViewData.SubItemAttachment;
if (attach != null && attach.IsSelected) {
_objectDragType = ObjectDragTypes.kAttachment;
}
PointF graphMousePos = _nodeLayoutManager.ViewToGraph(_lastMousePosition);
NodeViewData.RangeType rangeType = _currentNode.CheckFSMArrowRange(graphMousePos, out _fsmSubItem, out _fsmItemBoundingBox);
if (rangeType != NodeViewData.RangeType.kNode) {
_objectDragType = ObjectDragTypes.kNone;
if (Plugin.EditMode == EditModes.Design)
{
if (rangeType == NodeViewData.RangeType.kFSMLeftArrow)
{
_fsmDragMode = FSMDragModes.kLeft;
}
else if (rangeType == NodeViewData.RangeType.kFSMRightArrow)
{
_fsmDragMode = FSMDragModes.kRight;
}
}
}
}
if (_currentNode == null) {
_objectDragType = ObjectDragTypes.kGraph;
}
// focus the view if not focused
if (!Focused) {
// we focus twice to avoid an issue with focusing the view
Parent.Focus();
//OnMouseDown will cal OnGotFocus as well
//Focus();
}
base.OnMouseDown(e);
}
示例2: OnMouseDown
/// <summary>
/// Handles when a mouse button was pressed.
/// </summary>
protected override void OnMouseDown(MouseEventArgs e)
{
// the graph has not yet been dragged
_lastMousePosition = e.Location;
_isGraphDragged = false;
_isNodeDragged = false;
_dragAttachment = null;
_dragTargetAttachment = null;
if (!_clipboardPasteMode)
{
_currentNode = _rootNode.IsInside(_lastMousePosition);
_dragTargetNode = null;
_movedNodeGraph = null;
_movedNode = null;
if (_currentNode != null)
{
_isNodeDragged = _currentNode.CanBeDragged() && !KeyCtrlIsDown &&
(KeyShiftIsDown || _currentNode.Node.ParentCanAdoptChildren);
}
}
else
{
if (_currentNode == null)
{
_currentNode = _rootNode.IsInside(e.Location);
}
if (_dragTargetNode == null)
{
_dragTargetNode = _currentNode;
}
}
// update the mouse cursor when dragging nodes
if (IsPanMode || e.Button == MouseButtons.Middle)
{
_panStartMousePosition = e.Location;
Cursor = (e.Button == MouseButtons.Right) ? Cursors.NoMove2D : Cursors.SizeAll;
}
else if (e.Button == MouseButtons.Left && _currentNode != null)
{
Debug.Check(_nodeLayoutManager != null);
NodeViewData.SubItem subItem = _currentNode.GetSubItem(_currentNode, _nodeLayoutManager.ViewToGraph(e.Location));
NodeViewData.SubItemAttachment attach = subItem as NodeViewData.SubItemAttachment;
if (attach != null && attach.IsSelected)
{
_isNodeDragged = false;
}
}
// focus the view if not focused
if (!Focused)
{
// we focus twice to avoid an issue with focusing the view
Parent.Focus();
//OnMouseDown will cal OnGotFocus as well
//Focus();
}
base.OnMouseDown(e);
}