Home > DMT_EditorControl > createSplitScreen
DMT_EditorControl.createSplitScreen() method
Create Split screen
Signature
typescript
function createSplitScreen(
splitScreenType: EDMT_EditorSplitScreenDirection,
tabId: string,
): Promise<{ sourceSplitScreenId: string; newSplitScreenId: string } | undefined>;1
2
3
4
2
3
4
Parameters
Parameter | Type | Description |
|---|---|---|
splitScreenType | Split screen type, | |
tabId | string | Tab ID. This tab will be moved into the new split screen |
Returns
Promise<{ sourceSplitScreenId: string; newSplitScreenId: string } | undefined>
Split screen ID. sourceSplitScreenId represents the source split screen, and newSplitScreenId represents the new split screen
Remarks
Please make sure the split screen corresponding to tabId has more than two tabs; otherwise the split screen will not be executed and undefined will be returned
Example
javascript
// 1. 归一化布局:先合并既有分屏,保证两个标签页落在同一分屏
await eda.dmt_EditorControl.mergeAllDocumentFromSplitScreen();
// 2. 打开两个文档,让当前分屏持有两个标签页
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const pcbs = await eda.dmt_Pcb.getAllPcbsInfo();
await eda.dmt_EditorControl.openDocument(pages[0].uuid);
const tabPcb = await eda.dmt_EditorControl.openDocument(pcbs[0].uuid);
// 3. 把 PCB 标签页拆到一个新的水平分屏
const split = await eda.dmt_EditorControl.createSplitScreen('horizontal', tabPcb);
console.log('source split:', split?.sourceSplitScreenId);
console.log('new split:', split?.newSplitScreenId);
// 4. 回读新分屏的标签页,确认 PCB 已在其中
const tabs = await eda.dmt_EditorControl.getTabsBySplitScreenId(split.newSplitScreenId);
console.log('tabs in new split:', tabs.map(t => t.title));
// 5. 合并所有分屏,恢复单屏布局
const merged = await eda.dmt_EditorControl.mergeAllDocumentFromSplitScreen();
console.log('merged:', merged);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21