diff --git a/src/main/scenes/svg.tsx b/src/main/scenes/svg.tsx index b404454c..e36c3451 100644 --- a/src/main/scenes/svg.tsx +++ b/src/main/scenes/svg.tsx @@ -201,12 +201,12 @@ export class Svg extends Component { const svgElementDetails = (element: UMLElement, x: number, y: number) => { return { - x: (x), - y: (y), - width: (element.bounds.width), - height: (element.bounds.height), - className: (element.name ? element.name.replace(/[<>]/g, '') : ''), - fill: (element.fillColor || theme.color.background) + x, + y, + width: element.bounds.width, + height: element.bounds.height, + className: element.name ? element.name.replace(/[<>]/g, '') : '', + fill: element.fillColor || theme.color.background, }; }; @@ -227,14 +227,11 @@ export class Svg extends Component { const ElementComponent = Components[element.type as UMLElementType | UMLRelationshipType]; switch (ElementComponent) { case UMLClassifierComponent: - // If the ElementComponent is of type UMLClassifierComponent, create an array of all members (attributes and methods) for that component. + // If the ElementComponent is of type UMLClassifierComponent, create an array of all members (attributes and methods) for that component. // Unlike other components, the UMLClassifierComponent needs its members to be children within the component to avoid border rendering issues. const members = elements.filter((member) => member.owner === element.id); return ( - + {members.map((memberElement, memberIndex) => { // Nest the members within the UMLClassifierComponent so the border rectangle and path get rendered afterward. @@ -244,7 +241,11 @@ export class Svg extends Component { key={memberElement.id} {...svgElementDetails(memberElement, 0, memberElement.bounds.y - element.bounds.y)} > - + ); })} @@ -259,7 +260,11 @@ export class Svg extends Component { return ( diff --git a/src/tests/unit/test-resources/class-diagram-as-svg.json b/src/tests/unit/test-resources/class-diagram-as-svg.json index 5ca53674..884b8093 100644 --- a/src/tests/unit/test-resources/class-diagram-as-svg.json +++ b/src/tests/unit/test-resources/class-diagram-as-svg.json @@ -1 +1 @@ -"PackageClass+ attribute: Type+ method()Class+ attribute: Type+ method()" \ No newline at end of file +"PackageClass+ attribute: Type+ method()Class+ attribute: Type+ method()"