当前位置: 首页>>代码示例>>C#>>正文


C# Point.AsDynamoType方法代码示例

本文整理汇总了C#中System.Windows.Point.AsDynamoType方法的典型用法代码示例。如果您正苦于以下问题:C# Point.AsDynamoType方法的具体用法?C# Point.AsDynamoType怎么用?C# Point.AsDynamoType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Point的用法示例。


在下文中一共展示了Point.AsDynamoType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSelectableFromPoint

            private ISelectable GetSelectableFromPoint(Point point)
            {
                foreach (var selectable in DynamoSelection.Instance.Selection)
                {
                    var locatable = selectable as ILocatable;
                    if (locatable == null || (!locatable.Rect.Contains(point.AsDynamoType())))
                        continue;

                    return selectable;
                }

                return null;
            }
开发者ID:sm6srw,项目名称:Dynamo,代码行数:13,代码来源:StateMachine.cs

示例2: HandleMouseMove

            internal bool HandleMouseMove(object sender, Point mouseCursor)
            {
                if (this.currentState == State.Connection)
                {
                    // If we are currently connecting and there is an active 
                    // connector, redraw it to match the new mouse coordinates.
                    owningWorkspace.UpdateActiveConnector(mouseCursor);
                }
                else if (this.currentState == State.WindowSelection)
                {
                    // When the mouse is held down, reposition the drag selection box.
                    double x = Math.Min(mouseDownPos.X, mouseCursor.X);
                    double y = Math.Min(mouseDownPos.Y, mouseCursor.Y);
                    double width = Math.Abs(mouseDownPos.X - mouseCursor.X);
                    double height = Math.Abs(mouseCursor.Y - mouseDownPos.Y);

                    // We perform cross selection (i.e. select a node whenever 
                    // it touches the selection box as opposed to only select 
                    // it when it is entirely within the selection box) when 
                    // mouse moves in the opposite direction (i.e. the current 
                    // mouse position is smaller than the point mouse-down 
                    // happened).
                    // 
                    bool isCrossSelection = mouseCursor.X < mouseDownPos.X;

                    SelectionBoxUpdateArgs args = null;
                    args = new SelectionBoxUpdateArgs(x, y, width, height);
                    args.SetSelectionMode(isCrossSelection);
                    this.owningWorkspace.RequestSelectionBoxUpdate(this, args);

                    var rect = new Dynamo.Utilities.Rect2D(x, y, width, height);

                    var command = new DynCmd.SelectInRegionCommand(rect, isCrossSelection);

                    owningWorkspace.DynamoViewModel.ExecuteCommand(command);

                }
                else if (this.currentState == State.DragSetup)
                {
                    // There are something in the selection, but none is ILocatable.
                    if (!DynamoSelection.Instance.Selection.Any((x) => (x is ILocatable)))
                    {
                        SetCurrentState(State.None);
                        return false;
                    }

                    if (Keyboard.Modifiers != ModifierKeys.Control)
                    {
                        // Record and begin the drag operation for selected nodes.
                        var operation = DynCmd.DragSelectionCommand.Operation.BeginDrag;
                        var command = new DynCmd.DragSelectionCommand(
                            mouseCursor.AsDynamoType(),
                            operation);
                        owningWorkspace.DynamoViewModel.ExecuteCommand(command);

                        SetCurrentState(State.NodeReposition);
                        return true;
                    }

                }
                else if (this.currentState == State.NodeReposition)
                {
                    // Update the dragged nodes (note: this isn't recorded).
                    owningWorkspace.UpdateDraggedSelection(mouseCursor.AsDynamoType());
                }

                return false; // Mouse event not handled.
            }
开发者ID:sm6srw,项目名称:Dynamo,代码行数:68,代码来源:StateMachine.cs


注:本文中的System.Windows.Point.AsDynamoType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。