Merge pull request #4074 from l2fprod/feature/user_journey_expand_section

💄 section width now covers all tasks
This commit is contained in:
Sidharth Vinod 2023-02-24 20:00:17 +05:30 committed by GitHub
commit f62c4831ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -224,6 +224,17 @@ export const drawTasks = function (diagram, tasks, verticalPos) {
num = sectionNumber % fills.length;
colour = textColours[sectionNumber % textColours.length];
// count how many consecutive tasks have the same section
let taskInSectionCount = 0;
const currentSection = task.section;
for (let taskIndex = i; taskIndex < tasks.length; taskIndex++) {
if (tasks[taskIndex].section == currentSection) {
taskInSectionCount = taskInSectionCount + 1;
} else {
break;
}
}
const section = {
x: i * conf.taskMargin + i * conf.width + LEFT_MARGIN,
y: 50,
@ -231,6 +242,7 @@ export const drawTasks = function (diagram, tasks, verticalPos) {
fill,
num,
colour,
taskCount: taskInSectionCount,
};
svgDraw.drawSection(diagram, section, conf);

View File

@ -196,7 +196,10 @@ export const drawSection = function (elem, section, conf) {
rect.x = section.x;
rect.y = section.y;
rect.fill = section.fill;
rect.width = conf.width;
// section width covers all nested tasks
rect.width =
conf.width * section.taskCount + // width of the tasks
conf.diagramMarginX * (section.taskCount - 1); // width of space between tasks
rect.height = conf.height;
rect.class = 'journey-section section-type-' + section.num;
rect.rx = 3;