Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: trigger resize event for scroller
Browse files Browse the repository at this point in the history
OpportunityLiu committed Apr 4, 2024

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent ebf248d commit 4ed35c7
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
@@ -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) {
7 changes: 1 addition & 6 deletions packages/x6/src/graph/graph.ts
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 4ed35c7

Please sign in to comment.