-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
使用graph.centerContent()居中,实际内容以画布左上角为中心居中 #3720
Comments
Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. |
我也遇到这个问题,我是先重置节点this.graph.resetCells(cells); 然后调用this.graph.centerContent(); 发现也是在左上角。然后我是通过settimeout,设置了一个100毫秒的延迟之后再调用centerContent。我猜测可能是因为新建节点和计算位置居中需要保证一个顺序关系。 |
我的居中事件,是按钮触发的,有足够多的时间,所以不存在你说的先后问题,也非常感谢你了 |
能否提供一个可以复现的 demo 看下呢? |
This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread. |
问题描述
使用graph.centerContent()居中,实际内容以画布左上角为中心居中
没有以画布的中心居中
重现链接
集成工程项目中
重现步骤
const saveJob = () => {
console.log("saveJob")
// console.log(graph.toJSON())
graph.centerContent()
}
预期行为
想得到跟demo一样的居中效果
想知道是什么地方影响到了画布的居中
平台
屏幕截图或视频(可选)
居中前
![1688109595267](https://private-user-images.githubusercontent.com/85269941/250022340-35be1e3b-93d4-4ffb-9658-4e44a98ab6cd.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTU4MjEsIm5iZiI6MTczOTA1NTUyMSwicGF0aCI6Ii84NTI2OTk0MS8yNTAwMjIzNDAtMzViZTFlM2ItOTNkNC00ZmZiLTk2NTgtNGU0NGE5OGFiNmNkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDIyNTg0MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE1NWQxZDhlMTNjMWRhZjYyODM4ZmQ0ODc3MWZlMGVhNTQyNjU4OTA3NmQ3NTM5NmU0ZDY3OWJkMTQ3OGVjYjAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.81KfaTVHcHEddsIkCH6u-gqGSsY8XmN0BCnieZar18M)
![image](https://private-user-images.githubusercontent.com/85269941/250022508-9af86832-c915-47a8-8b73-cc9b9d8b8c2a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTU4MjEsIm5iZiI6MTczOTA1NTUyMSwicGF0aCI6Ii84NTI2OTk0MS8yNTAwMjI1MDgtOWFmODY4MzItYzkxNS00N2E4LThiNzMtY2M5YjlkOGI4YzJhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDIyNTg0MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFjYTdjYTRmM2VmZThkOTJhNWNhYmViZGY0ZGY4N2I2ZDVlYjRlNTFhNTA5OTIzNDRmNzgyZDNmYWY0Y2Q4YzgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.X9xRVPD671DhwEUNJJrl_yEzwVNK4WflIdgjMOX880k)
居中后
补充说明(可选)
No response
The text was updated successfully, but these errors were encountered: