updateContext method

  1. @override
void updateContext(
  1. GraphicsContext context
)
override

Implementation

@override
void updateContext(GraphicsContext context) {
  const kappa = 0.5522848;
  final ox = (_width / 2) * kappa;
  final oy = (_height / 2) * kappa;
  final x1 = _x - _width / 2;
  final y1 = _y - _height / 2;
  final x2 = _x + _width / 2;
  final y2 = _y + _height / 2;
  final xm = _x;
  final ym = _y;

  context.moveTo(x1, ym);
  context.bezierCurveTo(x1, ym - oy, xm - ox, y1, xm, y1);
  context.bezierCurveTo(xm + ox, y1, x2, ym - oy, x2, ym);
  context.bezierCurveTo(x2, ym + oy, xm + ox, y2, xm, y2);
  context.bezierCurveTo(xm - ox, y2, x1, ym + oy, x1, ym);
  context.closePath();
}