Skip to content

Visibility detector Lack of exposure calculations for shadows #315

Open
@FangJoker

Description

@FangJoker

need to include shadow clipping?

It is possible that the business has set a large widget shadow area, and if this is a slideable list, there may be a bias in the exposure calculation.

`Rect _computeClipRect() {
assert(RendererBinding.instance?.renderView != null);
var clipRect = Offset.zero & RendererBinding.instance!.renderView.size;

var parentLayer = parent;
while (parentLayer != null) {
  Rect? curClipRect;
  if (parentLayer is ClipRectLayer) {
    curClipRect = parentLayer.clipRect;
  } else if (parentLayer is ClipRRectLayer) {
    curClipRect = parentLayer.clipRRect!.outerRect;
  } else if (parentLayer is ClipPathLayer) {
    curClipRect = parentLayer.clipPath!.getBounds();
  } 

  /// the pruning of the shadow part should also be accumulated
  /// otherwise the calculation of the exposure area caused by the shadow area may be too large
  else if (parentLayer is PhysicalModelLayer) {
    curClipRect = parentLayer.clipPath!.getBounds();
  }

  if (curClipRect != null) {
    curClipRect = _localRectToGlobal(parentLayer, curClipRect);
    clipRect = clipRect.intersect(curClipRect);
  }

  parentLayer = parentLayer.parent;
}

return clipRect;

}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions