X6 icon indicating copy to clipboard operation
X6 copied to clipboard

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

Open Wendy0907 opened this issue 1 year ago • 2 comments

问题描述

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

Wendy0907 avatar Apr 23 '24 07:04 Wendy0907

👋 @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.

x6-bot[bot] avatar Apr 23 '24 07:04 x6-bot[bot]

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

light-years-run avatar Apr 25 '24 06:04 light-years-run