@@ -29,6 +29,11 @@ export class Node {
29
29
public maxWidth : number | undefined ;
30
30
public nodeRadius : number | undefined ;
31
31
// CodeSchemaAttributes - Not included
32
+ // Visual Studio generated properties
33
+ public boundsX : number | undefined ;
34
+ public boundsY : number | undefined ;
35
+ public boundsWidth : number | undefined ;
36
+ public boundsHeight : number | undefined ;
32
37
33
38
private categoryRef : ICategory | undefined ;
34
39
public setCategoryRef ( categoryRef : ICategory | undefined ) {
@@ -39,7 +44,11 @@ export class Node {
39
44
const jsStringProperties : string [ ] = [ ] ;
40
45
if ( this . id !== undefined ) { jsStringProperties . push ( `id: "${ this . id } "` ) ; }
41
46
const label = this . convertNewlines ( this . label ) ;
42
- if ( this . label !== undefined ) { jsStringProperties . push ( `label: "${ label } "` ) ; }
47
+ if ( this . label !== undefined ) {
48
+ jsStringProperties . push ( `label: "${ label } "` ) ;
49
+ } else {
50
+ jsStringProperties . push ( `label: "${ this . id } "` ) ;
51
+ }
43
52
const description = this . convertNewlines ( this . description ) ;
44
53
if ( this . description !== undefined ) { jsStringProperties . push ( `title: "${ description } "` ) ; }
45
54
if ( this . strokeThickness !== undefined ) { jsStringProperties . push ( `borderWidth: "${ this . strokeThickness } "` ) ; }
@@ -49,11 +58,12 @@ export class Node {
49
58
if ( this . categoryRef !== undefined && this . background === undefined && this . categoryRef . background !== undefined ) { jsStringColorProperties . push ( `background: "${ this . categoryRef . background } "` ) ; }
50
59
if ( this . categoryRef !== undefined && this . stroke === undefined && this . categoryRef . stroke !== undefined ) { jsStringColorProperties . push ( `border: "${ this . categoryRef . stroke } "` ) ; }
51
60
if ( jsStringColorProperties . length > 0 ) { jsStringProperties . push ( `color: { ${ jsStringColorProperties . join ( ', ' ) } }` ) ; }
61
+ if ( this . boundsX !== undefined && this . boundsY !== undefined ) { jsStringProperties . push ( `x: ${ this . boundsX } , y: ${ this . boundsY } , fixed: { x: true, y: true}` ) ; }
52
62
return `{${ jsStringProperties . join ( ', ' ) } }` ;
53
63
}
54
64
55
65
private convertNewlines ( text : string | undefined ) : string {
56
- if ( text === undefined ) {
66
+ if ( text === undefined || text . length === 0 ) {
57
67
return '' ;
58
68
}
59
69
text = text . replace ( '
' , '\\n' ) ;
0 commit comments