paintIntersectionObserver method

void paintIntersectionObserver(
  1. PaintingContext context,
  2. Offset offset,
  3. PaintingContextCallback callback
)

Implementation

void paintIntersectionObserver(PaintingContext context, Offset offset,
    PaintingContextCallback callback) {
  // Skip to next if not has intersection observer
  if (_onIntersectionChange == null) {
    callback(context, offset);
    return;
  }

  if (_intersectionObserverLayer.layer == null) {
    _intersectionObserverLayer.layer = IntersectionObserverLayer(
        elementSize: size,
        paintOffset: offset,
        onIntersectionChange: _onIntersectionChange!
    );
  } else {
    _intersectionObserverLayer.layer!.elementSize = semanticBounds.size;
    _intersectionObserverLayer.layer!.paintOffset = offset;
  }

  context.pushLayer(_intersectionObserverLayer.layer!, callback, offset);
}