getPoint method

Point<int> getPoint()

Implementation

math.Point<int> getPoint() {
  if (centerOnScreen) {
    final screenLeft = html.window.screenLeft ?? html.window.screenX;
    final screenTop = html.window.screenTop ?? html.window.screenY;
    final screenWidth = html.window.innerWidth ??
        html.document.documentElement?.clientWidth ??
        html.window.screen?.width;
    final screenHeight = html.window.innerHeight ??
        html.document.documentElement?.clientHeight ??
        html.window.screen?.height;

    if (screenLeft != null &&
        screenTop != null &&
        screenWidth != null &&
        screenHeight != null) {
      final left = (screenWidth - width) / 2;
      final top = (screenHeight - height) / 2;
      return math.Point<int>(left.toInt(), top.toInt());
    }
  }
  return math.Point(left, top);
}