Closed mengjie0320 closed 2 years ago
port set alignment=left not work;This is the docs link of customizing ports.md, , I can't find the reason why my code doesn't work from that; Code is here. addPort this.addPort( new CustomPortModel({ in: false, id: cmd.cmd_id || '', title: cmd.cmd_name || cmd.title, param: cmd.param, variable: cmd.variable, name: cmd.cmd_id || '', desc: cmd.cmd_name, // align: PortModelAlignment.LEFT, // align: "left", alignment: PortModelAlignment.LEFT }), ); CustomPortModel ` export interface AdvancedPortModelOptions extends DefaultPortModelOptions { id: string, name: string, desc: string; title: string; param: string; variable: string; // align: PortModelAlignment; alignment: PortModelAlignment; }
this.addPort( new CustomPortModel({ in: false, id: cmd.cmd_id || '', title: cmd.cmd_name || cmd.title, param: cmd.param, variable: cmd.variable, name: cmd.cmd_id || '', desc: cmd.cmd_name, // align: PortModelAlignment.LEFT, // align: "left", alignment: PortModelAlignment.LEFT }), );
export class CustomPortModel extends DefaultPortModel { title: string; param: string; variable: string; name: string; // name=id,用于查找节点 id: string; desc: string; // cmd_name字段 // alignment: string; alignment: PortModelAlignment;
constructor(options: AdvancedPortModelOptions) { console.log('DefaultPortModel options --> ', { ...options, type: CUSTOM_PORT_TYPE }) super({ ...options, type: CUSTOM_PORT_TYPE }); this.id = options?.id || ''; this.desc = options.desc; this.title = options.title; this.param = options.param; this.variable = options.variable; this.name = options.name; this.alignment = options.alignment; } ... } `
DefaultPortModel export declare class DefaultPortModel extends PortModel<DefaultPortModelGenerics> { constructor(isIn: boolean, name?: string, label?: string); constructor(options: DefaultPortModelOptions); deserialize(event: DeserializeEvent<this>): void; serialize(): { in: boolean; label: string; name: string; alignment: PortModelAlignment; parentNode: string; links: string[]; x: number; y: number; type: string; selected: boolean; extras: any; id: string; locked: boolean; }; link<T extends LinkModel>(port: PortModel, factory?: AbstractModelFactory<T>): T; canLinkToPort(port: PortModel): boolean; createLinkModel(factory?: AbstractModelFactory<LinkModel>): LinkModel; }
export declare class DefaultPortModel extends PortModel<DefaultPortModelGenerics> { constructor(isIn: boolean, name?: string, label?: string); constructor(options: DefaultPortModelOptions); deserialize(event: DeserializeEvent<this>): void; serialize(): { in: boolean; label: string; name: string; alignment: PortModelAlignment; parentNode: string; links: string[]; x: number; y: number; type: string; selected: boolean; extras: any; id: string; locked: boolean; }; link<T extends LinkModel>(port: PortModel, factory?: AbstractModelFactory<T>): T; canLinkToPort(port: PortModel): boolean; createLinkModel(factory?: AbstractModelFactory<LinkModel>): LinkModel; }
my port position setted by css
port set alignment=left not work;This is the docs link of customizing ports.md, , I can't find the reason why my code doesn't work from that; Code is here. addPort
this.addPort( new CustomPortModel({ in: false, id: cmd.cmd_id || '', title: cmd.cmd_name || cmd.title, param: cmd.param, variable: cmd.variable, name: cmd.cmd_id || '', desc: cmd.cmd_name, // align: PortModelAlignment.LEFT, // align: "left", alignment: PortModelAlignment.LEFT }), );
CustomPortModel ` export interface AdvancedPortModelOptions extends DefaultPortModelOptions { id: string, name: string, desc: string; title: string; param: string; variable: string; // align: PortModelAlignment; alignment: PortModelAlignment; }export class CustomPortModel extends DefaultPortModel { title: string; param: string; variable: string; name: string; // name=id,用于查找节点 id: string; desc: string; // cmd_name字段 // alignment: string; alignment: PortModelAlignment;
constructor(options: AdvancedPortModelOptions) { console.log('DefaultPortModel options --> ', { ...options, type: CUSTOM_PORT_TYPE }) super({ ...options, type: CUSTOM_PORT_TYPE }); this.id = options?.id || ''; this.desc = options.desc; this.title = options.title; this.param = options.param; this.variable = options.variable; this.name = options.name; this.alignment = options.alignment; } ... } `
DefaultPortModel
export declare class DefaultPortModel extends PortModel<DefaultPortModelGenerics> { constructor(isIn: boolean, name?: string, label?: string); constructor(options: DefaultPortModelOptions); deserialize(event: DeserializeEvent<this>): void; serialize(): { in: boolean; label: string; name: string; alignment: PortModelAlignment; parentNode: string; links: string[]; x: number; y: number; type: string; selected: boolean; extras: any; id: string; locked: boolean; }; link<T extends LinkModel>(port: PortModel, factory?: AbstractModelFactory<T>): T; canLinkToPort(port: PortModel): boolean; createLinkModel(factory?: AbstractModelFactory<LinkModel>): LinkModel; }