|
1 | 1 | import { ICategory } from "@model";
|
| 2 | +import { BaseElement } from "./BaseElement"; |
2 | 3 |
|
3 | 4 | // https://schemas.microsoft.com/vs/2009/dgml/dgml.xsd
|
4 |
| -export class Node { |
| 5 | +export class Node extends BaseElement { |
5 | 6 | public id: string | undefined;
|
6 | 7 | public category: string | undefined;
|
7 | 8 | public description: string | undefined;
|
@@ -54,13 +55,13 @@ export class Node {
|
54 | 55 | if (this.strokeThickness !== undefined) { jsStringProperties.push(`borderWidth: "${this.strokeThickness}"`); }
|
55 | 56 | const jsStringColorProperties: string[] = [];
|
56 | 57 | if (this.stroke !== undefined) { jsStringColorProperties.push(`border: "${this.stroke}"`); }
|
57 |
| - if (this.background !== undefined) { jsStringColorProperties.push(`background: "${this.background}"`); } |
58 |
| - if (this.categoryRef !== undefined && this.background === undefined && this.categoryRef.background !== undefined) { jsStringColorProperties.push(`background: "${this.categoryRef.background}"`); } |
59 |
| - if (this.categoryRef !== undefined && this.stroke === undefined && this.categoryRef.stroke !== undefined) { jsStringColorProperties.push(`border: "${this.categoryRef.stroke}"`); } |
| 58 | + if (this.background !== undefined) { jsStringColorProperties.push(`background: "${this.convertColorValue(this.background)}"`); } |
| 59 | + if (this.categoryRef !== undefined && this.background === undefined && this.categoryRef.background !== undefined) { jsStringColorProperties.push(`background: "${this.convertColorValue(this.categoryRef.background)}"`); } |
| 60 | + if (this.categoryRef !== undefined && this.stroke === undefined && this.categoryRef.stroke !== undefined) { jsStringColorProperties.push(`border: "${this.convertColorValue(this.categoryRef.stroke)}"`); } |
60 | 61 | if (jsStringColorProperties.length > 0) { jsStringProperties.push(`color: { ${jsStringColorProperties.join(', ')} }`); }
|
61 | 62 | if (this.boundsX !== undefined && this.boundsY !== undefined) { jsStringProperties.push(`x: ${this.boundsX}, y: ${this.boundsY}, fixed: { x: true, y: true}`); }
|
62 |
| - if (this.boundsWidth !== undefined) { jsStringProperties.push(`widthConstraint: { minimum: ${this.boundsWidth} }`) } |
63 |
| - if (this.boundsHeight !== undefined) { jsStringProperties.push(`heightConstraint: { minimum: ${this.boundsHeight}, valign: top }`) } |
| 63 | + if (this.boundsWidth !== undefined) { jsStringProperties.push(`widthConstraint: { minimum: ${this.boundsWidth} }`); } |
| 64 | + if (this.boundsHeight !== undefined) { jsStringProperties.push(`heightConstraint: { minimum: ${this.boundsHeight}, valign: top }`); } |
64 | 65 | return `{${jsStringProperties.join(', ')}}`;
|
65 | 66 | }
|
66 | 67 |
|
|
0 commit comments