diff --git a/packages/x6/src/graph/pagebreak-accessor.ts b/packages/x6/src/graph/pagebreak-accessor.ts index 67a16fbe45c..1c877c50e6f 100644 --- a/packages/x6/src/graph/pagebreak-accessor.ts +++ b/packages/x6/src/graph/pagebreak-accessor.ts @@ -17,6 +17,7 @@ export class PageBreakAccessor extends BaseGraph { enablePageBreak() { if (!this.isPageBreakEnabled()) { this.options.pageBreak.enabled = true + this.sizeDidChange() } return this } @@ -24,6 +25,7 @@ export class PageBreakAccessor extends BaseGraph { disablePageBreak() { if (this.isPageBreakEnabled()) { this.options.pageBreak.enabled = false + this.sizeDidChange() } return this } @@ -47,6 +49,7 @@ export class PageBreakAccessor extends BaseGraph { setPageBreakColor(color: string) { if (this.getPageBreakColor() !== color) { this.options.pageBreak.stroke = color + this.sizeDidChange() } return this } @@ -66,6 +69,7 @@ export class PageBreakAccessor extends BaseGraph { setPageBreakDashed(dsahed: boolean) { if (dsahed !== this.isPageBreakDashed()) { this.options.pageBreak.dsahed = dsahed + this.sizeDidChange() } return this } @@ -85,6 +89,7 @@ export class PageBreakAccessor extends BaseGraph { setPageBreakMinDist(minDist: number) { if (minDist !== this.getPageBreakMinDist()) { this.options.pageBreak.minDist = minDist + this.sizeDidChange() } return this } diff --git a/packages/x6/src/graph/pagebreak-manager.ts b/packages/x6/src/graph/pagebreak-manager.ts index b83598a64da..751d2abcefc 100644 --- a/packages/x6/src/graph/pagebreak-manager.ts +++ b/packages/x6/src/graph/pagebreak-manager.ts @@ -6,7 +6,13 @@ export class PageBreakManager extends BaseManager { protected verticalPageBreaks: Polyline[] protected horizontalPageBreaks: Polyline[] - updatePageBreaks(visible: boolean, width: number, height: number) {} + updatePageBreaks(visible: boolean, width: number, height: number) { + if (this.graph.infinite) { + this.updatePageBreaksInfinite(visible, width, height) + } else { + this.updatePageBreaksNormal(visible, width, height) + } + } updatePageBreaksNormal(visible: boolean, width: number, height: number) { const s = this.view.scale @@ -38,7 +44,7 @@ export class PageBreakManager extends BaseManager { this.drawPageBreaks(false, vCount, pb, right, bottom, false) } - updatePageBreaksInfinite(visible: boolean) { + updatePageBreaksInfinite(visible: boolean, width: number, height: number) { const ps = this.view.scale * this.graph.pageScale const fmt = this.graph.pageFormat const gb = this.view.getBackgroundPageBounds() @@ -67,11 +73,11 @@ export class PageBreakManager extends BaseManager { infinite: boolean, ) { if (horizontal) { - if (this.horizontalPageBreaks == null && count > 0) { + if (this.horizontalPageBreaks == null) { this.horizontalPageBreaks = [] } } else { - if (this.verticalPageBreaks == null && count > 0) { + if (this.verticalPageBreaks == null) { this.verticalPageBreaks = [] } }