mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-09 15:24:13 +01:00
feat: Match timeline section width to tasks
This commit is contained in:
@@ -141,11 +141,14 @@ export const draw = function (text: string, id: string, version: string, diagObj
|
|||||||
|
|
||||||
if (sections && sections.length > 0) {
|
if (sections && sections.length > 0) {
|
||||||
sections.forEach((section) => {
|
sections.forEach((section) => {
|
||||||
|
//filter task where tasks.section == section
|
||||||
|
const tasksForSection = tasks.filter((task) => task.section === section);
|
||||||
|
|
||||||
const sectionNode: Block<string, number> = {
|
const sectionNode: Block<string, number> = {
|
||||||
number: sectionNumber,
|
number: sectionNumber,
|
||||||
descr: section,
|
descr: section,
|
||||||
section: sectionNumber,
|
section: sectionNumber,
|
||||||
width: 150,
|
width: 200 * Math.max(tasksForSection.length, 1) - 50,
|
||||||
padding: 20,
|
padding: 20,
|
||||||
maxHeight: maxSectionHeight,
|
maxHeight: maxSectionHeight,
|
||||||
};
|
};
|
||||||
@@ -159,8 +162,6 @@ export const draw = function (text: string, id: string, version: string, diagObj
|
|||||||
masterY += maxSectionHeight + 50;
|
masterY += maxSectionHeight + 50;
|
||||||
|
|
||||||
//draw tasks for this section
|
//draw tasks for this section
|
||||||
//filter task where tasks.section == section
|
|
||||||
const tasksForSection = tasks.filter((task) => task.section === section);
|
|
||||||
if (tasksForSection.length > 0) {
|
if (tasksForSection.length > 0) {
|
||||||
drawTasks(
|
drawTasks(
|
||||||
svg,
|
svg,
|
||||||
|
|||||||
Reference in New Issue
Block a user