Skip to content

Commit

Permalink
feat: trigger resize event for scroller
Browse files Browse the repository at this point in the history
  • Loading branch information
OpportunityLiu committed Apr 4, 2024
1 parent ebf248d commit 4ed35c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 6 additions & 0 deletions packages/x6-plugin-scroller/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
7 changes: 1 addition & 6 deletions packages/x6/src/graph/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,12 +556,7 @@ export class Graph extends Basecoat<EventArgs> {
}

resize(width?: number, height?: number) {
const scroller = this.getPlugin<any>('scroller')
if (scroller) {
scroller.resize(width, height)
} else {
this.transform.resize(width, height)
}
this.size.resize(width, height)
return this
}

Expand Down

0 comments on commit 4ed35c7

Please sign in to comment.