Home > DMT_EditorControl > zoomToAllPrimitives
DMT_EditorControl.zoomToAllPrimitives() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Zoom to all primitives (fit all)
Signature
typescript
function zoomToAllPrimitives(
tabId?: string,
): Promise<{ left: number; right: number; top: number; bottom: number } | false>;1
2
3
2
3
Parameters
Parameter | Type | Description |
|---|---|---|
tabId | string | (Optional) Tab ID. If not passed in, the canvas with the last input focus will be used |
Returns
Promise<{ left: number; right: number; top: number; bottom: number } | false>
Region data after zooming. false indicates that the canvas does not support the zoom operation or the tabId does not exist
Remarks
In the returned data, the coordinate unit span of the schematic and symbol canvases is 0.01inch, and that of the PCB and footprint canvases is mil
Example
javascript
// 1. 打开一个原理图页,确定缩放的画布
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const tabId = await eda.dmt_EditorControl.openDocument(pages[0].uuid);
// 2. 适应全部图元,返回缩放后的可视区域边界
const bounds = await eda.dmt_EditorControl.zoomToAllPrimitives(tabId);
console.log('bounds:', bounds);1
2
3
4
5
6
7
2
3
4
5
6
7