Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

antv/X6【2.x】resize固定值渲染后,宽度却不是设定的固定值 #4273

Open
Wendy0907 opened this issue Apr 23, 2024 · 2 comments

Comments

@Wendy0907
Copy link

问题描述

antvX6【2.x】resize固定值渲染后,宽度却不是设定的固定值

重现链接

//

重现步骤

.js

const  containerDom = document.getElementById('graph')
this.graph=new Graph({
  container:containerDom,
  ......
})

window.onresize=()=>{
  return (()=>{
    let element = document.querySelector('.cavans');
    if(element!=null){
      let width = element.clientWidth
      let height = element.clientHeight
      if(isNaN(width) || isNaN(height)) return
      if(this.graph !=null){
        thia.graph.resize(width,height)
      }
    }
  })
}()



.vue

<template>
  <div class="cavans">
    <div id="graph"></div>
  </div> 
</template>

预期行为

画布能根据设置的值渲染

平台

windows
chrome69+
X6版本:2.11.1

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

@x6-bot
Copy link
Contributor

x6-bot bot commented Apr 23, 2024

👋 @Wendy0907

Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.
We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@light-years-run
Copy link

graph.on('resize',()=>{
graph.zoomToFit()
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants