Home > DMT_EditorControl > zoomToRegion
DMT_EditorControl.zoomToRegion() 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 region
Signature
typescript
function zoomToRegion(
left: number,
right: number,
top: number,
bottom: number,
tabId?: string,
): Promise<boolean>;1
2
3
4
5
6
7
2
3
4
5
6
7
Parameters
Parameter | Type | Description |
|---|---|---|
left | number | First X coordinate of the rectangle |
right | number | Second X coordinate of the rectangle |
top | number | First Y coordinate of the rectangle |
bottom | number | Second Y coordinate of the rectangle |
tabId | string | (Optional) Tab ID. If not passed in, the canvas with the last input focus will be used |
Returns
Promise<boolean>
Whether the operation is successful
Remarks
In the schematic and symbol canvases, the coordinate unit span is 0.01inch; in the PCB and footprint canvases, it is mil
Example
javascript
// 1. 打开一个原理图页,确定缩放的画布
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const tabId = await eda.dmt_EditorControl.openDocument(pages[0].uuid);
// 2. 缩放到 (0,0)-(400,300) 的矩形区域
const zoomed = await eda.dmt_EditorControl.zoomToRegion(0, 400, 0, 300, tabId);
console.log('zoomed:', zoomed);1
2
3
4
5
6
7
2
3
4
5
6
7