diff --git a/packages/x6-plugin-scroller/src/index.ts b/packages/x6-plugin-scroller/src/index.ts index e452c0bcfa5..439060601fe 100644 --- a/packages/x6-plugin-scroller/src/index.ts +++ b/packages/x6-plugin-scroller/src/index.ts @@ -64,6 +64,12 @@ export class Scroller resize(width?: number, height?: number) { this.scrollerImpl.resize(width, height) + const size = { + width: this.scrollerImpl.options.width, + height: this.scrollerImpl.options.height, + } + this.trigger('resize', size) + this.graph.trigger('resize', size) } resizePage(width?: number, height?: number) { diff --git a/packages/x6/src/graph/graph.ts b/packages/x6/src/graph/graph.ts index cbb422922ba..cd40af7e0e1 100644 --- a/packages/x6/src/graph/graph.ts +++ b/packages/x6/src/graph/graph.ts @@ -556,12 +556,7 @@ export class Graph extends Basecoat { } resize(width?: number, height?: number) { - const scroller = this.getPlugin('scroller') - if (scroller) { - scroller.resize(width, height) - } else { - this.transform.resize(width, height) - } + this.size.resize(width, height) return this }