initialize method

void initialize(
  1. Vector2 _screenSize,
  2. JoystickController joystickController
)

Implementation

void initialize(Vector2 _screenSize, JoystickController joystickController) {
  this._screenSize = _screenSize;
  _joystickController = joystickController;
  Offset osBackground = Offset(
    margin.left,
    _screenSize.y - margin.bottom,
  );
  _backgroundRect = Rect.fromCircle(
    center: osBackground,
    radius: size / 2,
  );

  Offset osKnob = Offset(
    _backgroundRect!.center.dx,
    _backgroundRect!.center.dy,
  );

  _knobRect = Rect.fromCircle(
    center: osKnob,
    radius: size / 4,
  );

  _dragPosition = _knobRect!.center;
}