protected void DragShapes() { Point delta = CurrentMousePosition.Delta(LastMousePosition); Controller.DragSelectedElements(delta); Controller.Canvas.Cursor = Cursors.SizeAll; }
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); } }
protected void DragAnchor() { Point delta = CurrentMousePosition.Delta(LastMousePosition); bool connectorAttached = HoverShape.SnapCheck(SelectedAnchor, delta); if (!connectorAttached) { HoverShape.DisconnectShapeFromConnector(SelectedAnchor.Type); HoverShape.RemoveConnection(SelectedAnchor.Type); } }
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); }
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); }
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); } }
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); } }
protected bool MouseHasReallyMoved() { return(CurrentMousePosition.Delta(LastMousePosition) != Point.Empty); }