boundingClientRect property

BoundingClientRect boundingClientRect

Implementation

BoundingClientRect get boundingClientRect {
  BoundingClientRect boundingClientRect = BoundingClientRect.zero(BindingContext(ownerView, ownerView.contextId, allocateNewBindingObject()));
  if (isRendererAttached) {
    flushLayout();
    RenderBoxModel sizedBox = renderBoxModel!;
    // Force flush layout.
    if (!sizedBox.hasSize) {
      sizedBox.markNeedsLayout();
      sizedBox.owner!.flushLayout();
    }

    if (sizedBox.hasSize) {
      Offset offset = _getOffset(sizedBox, ancestor: ownerDocument.documentElement, excludeScrollOffset: true);
      Size size = sizedBox.size;
      boundingClientRect = BoundingClientRect(
          context: BindingContext(ownerView, ownerView.contextId, allocateNewBindingObject()),
          x: offset.dx,
          y: offset.dy,
          width: size.width,
          height: size.height,
          top: offset.dy,
          right: offset.dx + size.width,
          bottom: offset.dy + size.height,
          left: offset.dx);
    }
  }

  return boundingClientRect;
}