private void OnDragHandler(Vector2 dragged, Vector2 currentPosition) { var currentAngle = currentPosition.AngleWithCenterIn(Position); var rotation = currentAngle - _lastAngle; _lastAngle = currentAngle; Rotation = Rotation + rotation; if (OnRotation != null) OnRotation(rotation); }
private void OnStartDragHandler(Vector2 currentPosition) { _lastAngle = currentPosition.AngleWithCenterIn(Position); _originalRotation = Rotation; if (OnStartRotation != null) OnStartRotation(_originalRotation); }
public void AngleWithoutCenterInOriginAndPointWithSameCoordinates() { var vec = new Vector2(3.0f); var angle = vec.AngleWithCenterIn(new Vector2(1.0f)); Assert.AreEqual(45.0f, angle); }
public void AngleWithCenterInOriginAndPointInYAxis() { var vec = new Vector2(0.0f, 3.0f); var angle = vec.AngleWithCenterIn(Vector2.Zero); Assert.AreEqual(90.0f, angle); }