Angular 材料覆盖和滚动

Angular 材料覆盖和滚动,angular,angular-cdk,Angular,Angular Cdk,我用CDK overlay创建了一个覆盖,我希望覆盖跟随其原点,它在原点位于视口中时工作,否则覆盖将保持在顶部:0px。是否有一种方法允许覆盖具有负的顶部值 public openPopover(origin: any) { this.isOpen = true; const positionStrategy = this.overlay.position() .flexibleConnectedTo(origin.target) .withPo

我用CDK overlay创建了一个覆盖,我希望覆盖跟随其原点,它在原点位于视口中时工作,否则覆盖将保持在顶部:0px。是否有一种方法允许覆盖具有负的顶部值

public openPopover(origin: any) {
    this.isOpen = true;

    const positionStrategy = this.overlay.position()
        .flexibleConnectedTo(origin.target)
        .withPositions([
            new ConnectionPositionPair(
                { originX: this.originX, originY: this.originY },
                { overlayX: this.overlayX, overlayY: this.overlayY },
            ),
            ])
            .withPush(true);

    const scrollStrategy = this.overlay.scrollStrategies.reposition({ scrollThrottle: 10 });

    this.overlayRef = this.overlay.create({
        backdropClass: 'popover__backdrop',
        hasBackdrop: true,
        positionStrategy,
        scrollStrategy,
    });
    this.overlayRef.attach(this.templatePortal);
    this.overlayRef.backdropClick().pipe(takeUntil(this.destroy$)).subscribe(() => {
        this.closePopover();
    });
}