Skip to content

Commit

Permalink
Merge branch 'feature/bpmn-2.0-adaptions' of https://github.com/ls1in…
Browse files Browse the repository at this point in the history
…tum/Apollon into feature/bpmn-2.0-adaptions
  • Loading branch information
matthiaslehnertum committed Nov 23, 2023
2 parents 58af71a + ec3d131 commit a9572ad
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/main/scenes/svg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ export class Svg extends Component<Props, State> {
}
}
}

return { minX: Math.min(minX, 0), minY: Math.min(minY, 0) };
};

Expand All @@ -210,12 +211,14 @@ export class Svg extends Component<Props, State> {
};
};

const tfact = translationFactor();

return (
<StoreProvider initialState={state}>
<ThemeProvider theme={theme}>
<svg
width={bounds.width + 1}
height={bounds.height + 1}
width={bounds.width - tfact.minX + 1}
height={bounds.height - tfact.minY + 1}
xmlns="http://www.w3.org/2000/svg"
xmlnsXlink="http://www.w3.org/1999/xlink"
fill={theme.color.background}
Expand All @@ -231,7 +234,10 @@ export class Svg extends Component<Props, State> {
// 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 (
<svg key={element.id} {...svgElementDetails(element, element.bounds.x, element.bounds.y)}>
<svg
key={element.id}
{...svgElementDetails(element, element.bounds.x - tfact.minX, element.bounds.y - tfact.minY)}
>
<ElementComponent key={index} element={element}>
{members.map((memberElement, memberIndex) => {
// Nest the members within the UMLClassifierComponent so the border rectangle and path get rendered afterward.
Expand All @@ -256,11 +262,7 @@ export class Svg extends Component<Props, State> {
return (
<svg
key={element.id}
{...svgElementDetails(
element,
element.bounds.x - translationFactor().minX,
element.bounds.y - translationFactor().minY,
)}
{...svgElementDetails(element, element.bounds.x - tfact.minX, element.bounds.y - tfact.minY)}
>
<ElementComponent key={index} element={element} />
</svg>
Expand Down

0 comments on commit a9572ad

Please sign in to comment.