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

自适应 #128

Closed
Super-Xiao opened this issue Apr 1, 2024 · 5 comments
Closed

自适应 #128

Super-Xiao opened this issue Apr 1, 2024 · 5 comments

Comments

@Super-Xiao
Copy link

老哥 怎么默认加载dxf自适应宽高呢

@yanzexuan1
Copy link
Collaborator

I don't quite understand your question. After a dxf is loaded, it automatically zoom to the "home" view, which is defined in the dxf itself.

Do you want it to zoom to graphic extent rather than the original "home" view? To do so, you can firstly get the graphic extent, then zoom to it:

const extent = viewer.getActiveLayoutInfo().extent;
viewer.zoomToBBox(extent);

@Super-Xiao
Copy link
Author

image
目前我加载完成dxf是这样的 被放大了很多。

@yanzexuan1
Copy link
Collaborator

Oh, please try this:

const bbox = viewer.getBBox();
viewer.zoomToBBox(bbox);

@Super-Xiao
Copy link
Author

使用这段代码后
image

@yanzexuan1
Copy link
Collaborator

Can you check carefully, if there is any small entity somewhere in the corner? That often happen. Or, you can create a new dxf, draw some entities and test again.

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