Skip to content

Commit

Permalink
fix: 修复window resize失效问题
Browse files Browse the repository at this point in the history
  • Loading branch information
menghany authored and boyongjiong committed Dec 11, 2024
1 parent 0f4734b commit b8d3933
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/core/src/view/Graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ type ContainerStyle = {
@observer
class Graph extends Component<IGraphProps> {
private handleResize = () => {
let resizeWidth:number | undefined = this.props.graphModel.width
let resizeHeight:number | undefined = this.props.graphModel.height
let resizeWidth: number | undefined = this.props.graphModel.width
let resizeHeight: number | undefined = this.props.graphModel.height
let needUpdate = false
if (this.props.graphModel.isContainerWidth) {
resizeWidth = undefined
needUpdate = true
}
if (this.props.graphModel.isContainerHeight) {
resizeHeight = undefined
resizeHeight = undefined
needUpdate = true
}
if (needUpdate) {
Expand All @@ -56,7 +56,7 @@ class Graph extends Component<IGraphProps> {
this.props.options.width = this.props.graphModel.width
this.props.options.height = this.props.graphModel.height
}
private throttleResize = () => throttle(this.handleResize, 200)
private throttleResize = throttle(this.handleResize, 200)

componentDidMount() {
window.addEventListener('resize', this.throttleResize)
Expand Down

0 comments on commit b8d3933

Please sign in to comment.