Skip to content

Commit

Permalink
[activityDiagram] Fix condition layout in groups
Browse files Browse the repository at this point in the history
  • Loading branch information
hikerpig committed Jan 30, 2022
1 parent d5bab84 commit a264b27
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 7 additions & 1 deletion demo/cypress/integration/activity/activity.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ describe('Activity Diagram', () => {
activityDiagram
start
partition Outer {
if (diagram registered ?) then
:get implementation;
else (no)
:print error;
endif
group Inner {
while (data available?) is (available)
:read data;
Expand All @@ -19,7 +25,7 @@ partition Outer {
}
end`),
onRender(c) {
c.get('.component__group-rect').should('exist')
c.get('.activity__group-rect').should('exist')
},
},
])
Expand Down
12 changes: 5 additions & 7 deletions packages/pintora-diagrams/src/activity/artist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ class ActivityDraw {
...fontConfig,
fontWeight: 'bold',
},
{ class: 'component__group-rect' },
{ class: 'activity__group-rect' },
)
const labelTextDims = calcTextDims(groupLabel, fontConfig)

Expand All @@ -692,12 +692,10 @@ class ActivityDraw {
// console.log('will set parent', modelId, id, m.type)
if (modelId) this.g.setParent(modelId, id)
})
if ('children' in m.value) {
m.value.children.forEach(child => {
const childStepModel = this.model.stepModelMap.get(child.value.id)
if (childStepModel) setParentRecursive(childStepModel)
})
}
this.traverseStep(m, child => {
const childStepModel = this.model.stepModelMap.get(child.value.id)
if (childStepModel) setParentRecursive(childStepModel)
})
}

aGroup.children.map(s => {
Expand Down

0 comments on commit a264b27

Please sign in to comment.