feat: 增加根据选中节点功能
This commit is contained in:
@@ -268,7 +268,6 @@ export class ModelConstructor {
|
||||
element.sourceElement = sourceElement;
|
||||
// 处理element的index文本
|
||||
this.resolveElementIndex(element.get('indexCfg'), sourceElement);
|
||||
console.log(element.get('indexCfg'));
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
@@ -199,6 +199,21 @@ export class Engine {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用id选中某个节点
|
||||
* @param id
|
||||
* @param callback
|
||||
*/
|
||||
public selectElement(id: string, callback?: (element: Element) => void) {
|
||||
const elements = this.getElements();
|
||||
const stringId = id.toString();
|
||||
const targetElement = elements.find(item => item.sourceId === stringId);
|
||||
|
||||
if(targetElement) {
|
||||
callback && callback(targetElement);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 调整容器尺寸
|
||||
* @param containerName
|
||||
|
||||
Reference in New Issue
Block a user