Пример #1
0
        protected void DragShapes()
        {
            Point delta = CurrentMousePosition.Delta(LastMousePosition);

            Controller.DragSelectedElements(delta);
            Controller.Canvas.Cursor = Cursors.SizeAll;
        }
Пример #2
0
        protected void DragShapes()
        {
            BaseController controller = serviceManager.Get <IFlowSharpCanvasService>().ActiveController;

            controller.Canvas.Cursor = Cursors.SizeAll;
            Point delta = CurrentMousePosition.Delta(LastMousePosition);

            if (controller.SelectedElements.Count == 1 && controller.SelectedElements[0].IsConnector)
            {
                // Check both ends of any connector being moved.
                if (!controller.SnapController.SnapCheck(GripType.Start, delta, (snapDelta) => controller.DragSelectedElements(snapDelta)))
                {
                    if (!controller.SnapController.SnapCheck(GripType.End, delta, (snapDelta) => controller.DragSelectedElements(snapDelta)))
                    {
                        controller.DragSelectedElements(delta);
                        controller.SnapController.UpdateRunningDelta(delta);
                    }
                }
            }
            else
            {
                controller.DragSelectedElements(delta);
                controller.SnapController.UpdateRunningDelta(delta);
            }
        }
Пример #3
0
        protected void DragAnchor()
        {
            Point delta             = CurrentMousePosition.Delta(LastMousePosition);
            bool  connectorAttached = HoverShape.SnapCheck(SelectedAnchor, delta);

            if (!connectorAttached)
            {
                HoverShape.DisconnectShapeFromConnector(SelectedAnchor.Type);
                HoverShape.RemoveConnection(SelectedAnchor.Type);
            }
        }
Пример #4
0
        protected void DragSelectionBox()
        {
            // Normalize the rectangle to a top-left, bottom-right rectangle.
            int       x       = CurrentMousePosition.X.Min(StartSelectionPosition.X);
            int       y       = CurrentMousePosition.Y.Min(StartSelectionPosition.Y);
            int       w       = (CurrentMousePosition.X - StartSelectionPosition.X).Abs();
            int       h       = (CurrentMousePosition.Y - StartSelectionPosition.Y).Abs();
            Rectangle newRect = new Rectangle(x, y, w, h);
            Point     delta   = CurrentMousePosition.Delta(LastMousePosition);

            Controller.UpdateDisplayRectangle(SelectionBox, newRect, delta);
        }
Пример #5
0
        protected void DragSelectionBox()
        {
            BaseController controller = serviceManager.Get <IFlowSharpCanvasService>().ActiveController;
            // Normalize the rectangle to a top-left, bottom-right rectangle.
            int       x       = CurrentMousePosition.X.Min(StartSelectionPosition.X);
            int       y       = CurrentMousePosition.Y.Min(StartSelectionPosition.Y);
            int       w       = (CurrentMousePosition.X - StartSelectionPosition.X).Abs();
            int       h       = (CurrentMousePosition.Y - StartSelectionPosition.Y).Abs();
            Rectangle newRect = new Rectangle(x, y, w, h);
            Point     delta   = CurrentMousePosition.Delta(LastMousePosition);

            controller.UpdateDisplayRectangle(SelectionBox, newRect, delta);
        }
Пример #6
0
        protected void DragAnchor()
        {
            BaseController controller     = serviceManager.Get <IFlowSharpCanvasService>().ActiveController;
            Point          delta          = CurrentMousePosition.Delta(LastMousePosition);
            GraphicElement hoverShape     = HoverShape;
            ShapeAnchor    selectedAnchor = SelectedAnchor;

            if (!controller.SnapController.SnapCheck(selectedAnchor.Type, delta, (snapDelta) => hoverShape.UpdateSize(selectedAnchor, snapDelta)))
            {
                hoverShape.UpdateSize(selectedAnchor, delta);
                controller.SnapController.UpdateRunningDelta(delta);
            }
        }
Пример #7
0
        protected virtual void DragCanvas()
        {
            Point delta = CurrentMousePosition.Delta(LastMousePosition);

            Controller.Canvas.Cursor = Cursors.SizeAll;
            // Pick up every object on the canvas and move it.
            // This does not "move" the grid.
            Controller.MoveAllElements(delta);

            // Conversely, we redraw the grid and invalidate, which forces all the elements to redraw.
            //canvas.Drag(delta);
            //elements.ForEach(el => el.Move(delta));
            //canvas.Invalidate();
        }
        protected void DragShapes()
        {
            //  controller.Canvas.Cursor = Cursors.SizeAll;
            Point delta = CurrentMousePosition.Delta(LastMousePosition);

            /*  if (controller.SelectedElements.Count == 1 && controller.SelectedElements[0].IsConnector)
             * {
             *    // Check both ends of any connector being moved.
             *    if (!controller.SnapController.SnapCheck(GripType.Start, delta, (snapDelta) => controller.DragSelectedElements(snapDelta)))
             *    {
             *        if (!controller.SnapController.SnapCheck(GripType.End, delta, (snapDelta) => controller.DragSelectedElements(snapDelta)))
             *        {
             *            controller.DragSelectedElements(delta);
             *            controller.SnapController.UpdateRunningDelta(delta);
             *        }
             *    }
             * }*/
            //else
            {
                canvascontroller.DragSelectedElements(CurrentMousePosition);
                // controller.SnapController.UpdateRunningDelta(delta);
            }
        }
Пример #9
0
 protected bool MouseHasReallyMoved()
 {
     return(CurrentMousePosition.Delta(LastMousePosition) != Point.Empty);
 }