public virtual void OnUpdate() { if (Manager.IsCreating && !Rectangle.IsEmpty) { Point currentPosition = InputManager.MousePosition0Based; if (Manager.IsCornerMoving) { StartPosition = StartPosition.Add(InputManager.MouseVelocity.X, InputManager.MouseVelocity.Y); } else if (Manager.IsProportionalResizing) { if (NodeType == NodeType.Rectangle) { currentPosition = CaptureHelpers.SnapPositionToDegree(StartPosition, currentPosition, 90, 45); } else if (NodeType == NodeType.Line) { currentPosition = CaptureHelpers.SnapPositionToDegree(StartPosition, currentPosition, 45, 0); } } else if (Manager.IsSnapResizing) { currentPosition = Manager.SnapPosition(StartPosition, currentPosition); } EndPosition = currentPosition; } else if (Manager.IsMoving) { Move(InputManager.MouseVelocity); } }
public virtual void OnUpdate() { if (Manager.IsCreating) { Point pos = InputManager.ClientMousePosition; if (Manager.IsCornerMoving && !Manager.IsPanning) { StartPosition = StartPosition.Add(InputManager.MouseVelocity); } if (Manager.IsProportionalResizing || ForceProportionalResizing) { float degree, startDegree; if (ShapeType == ShapeType.DrawingLine || ShapeType == ShapeType.DrawingArrow) { degree = 45; startDegree = 0; } else { degree = 90; startDegree = 45; } pos = CaptureHelpers.SnapPositionToDegree(StartPosition, pos, degree, startDegree); } else if (Manager.IsSnapResizing) { pos = Manager.SnapPosition(StartPosition, pos); } EndPosition = pos; } else if (Manager.IsMoving && !Manager.IsPanning) { Move(InputManager.MouseVelocity); } if (LimitRectangleToInsideCanvas) { StartPosition = StartPosition.Restrict(Manager.Form.CanvasRectangle); EndPosition = EndPosition.Restrict(Manager.Form.CanvasRectangle); } }
public void Update() { BaseShape shape = CurrentShape; if (shape != null) { if (IsMoving) { ResizeManager.MoveCurrentArea(InputManager.MouseVelocity.X, InputManager.MouseVelocity.Y); } else if (IsCreating && !CurrentRectangle.IsEmpty) { Point currentPosition = InputManager.MousePosition0Based; if (IsProportionalResizing) { if (shape.NodeType == NodeType.Rectangle) { currentPosition = CaptureHelpers.SnapPositionToDegree(shape.StartPosition, currentPosition, 90, 45); } else if (shape.NodeType == NodeType.Line) { currentPosition = CaptureHelpers.SnapPositionToDegree(shape.StartPosition, currentPosition, 45, 0); } } else if (IsCornerMoving) { shape.StartPosition = shape.StartPosition.Add(InputManager.MouseVelocity.X, InputManager.MouseVelocity.Y); } else if (IsSnapResizing) { currentPosition = SnapPosition(shape.StartPosition, currentPosition); } shape.EndPosition = currentPosition; } } CheckHover(); ResizeManager.Update(); }
public virtual void OnUpdate() { if (Manager.IsCreating) { Point pos = InputManager.MousePosition0Based; if (Manager.IsCornerMoving) { StartPosition = StartPosition.Add(InputManager.MouseVelocity); } else if (Manager.IsProportionalResizing) { float degree, startDegree; if (ShapeType == ShapeType.DrawingLine || ShapeType == ShapeType.DrawingArrow) { degree = 45; startDegree = 0; } else { degree = 90; startDegree = 45; } pos = CaptureHelpers.SnapPositionToDegree(StartPosition, pos, degree, startDegree); } else if (Manager.IsSnapResizing) { pos = Manager.SnapPosition(StartPosition, pos); } EndPosition = pos; } else if (Manager.IsMoving) { Move(InputManager.MouseVelocity); } }