|
public nodeDefaults(obj: NodeModel): NodeModel {
obj.height = 50;
obj.style = { fill: 'transparent', strokeWidth: 2 };
obj.isExpanded = false;
return obj;
}; |
|
public clicked(args: IClickEventArgs) {
if(args.element instanceof Node) {
args.element.isExpanded = true;
this.diagram.dataBind();
this.diagram.doLayout();
this.diagram.fitToPage();
}
} |
|
public clicked(args: IDoubleClickEventArgs) {
if(args.source instanceof Node) {
args.source.isExpanded = true;
this.diagram.dataBind();
this.diagram.doLayout();
this.diagram.fitToPage();
}
} |
|
//TS
public nodeDefaults(obj: NodeModel): NodeModel {
obj.height = 100;
obj.annotations = [{constraints: AnnotationConstraints.ReadOnly}];
obj.style = { fill: 'transparent', strokeWidth: 2 };
obj.isExpanded = false;
return obj;
};
//HTML
<ejs-diagram #diagram id="diagram" width="100%" height="590px" [scrollSettings]='scrollSettings' [getConnectorDefaults]='connDefaults'
[getNodeDefaults]='nodeDefaults' [layout]='layout' [dataSourceSettings]='data' [setNodeTemplate]='setNodeTemplate'
[snapSettings]='snapSettings' (doubleClick)="clicked($event)" (created)="created($event)">
</ejs-diagram> |