Closed Super-Xiao closed 2 months ago
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);
目前我加载完成dxf是这样的 被放大了很多。
Oh, please try this:
const bbox = viewer.getBBox();
viewer.zoomToBBox(bbox);
使用这段代码后
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.
老哥 怎么默认加载dxf自适应宽高呢