diff --git a/buildoz.css b/buildoz.css index 37c6b09..c2b3bbe 100644 --- a/buildoz.css +++ b/buildoz.css @@ -397,7 +397,7 @@ bz-gantt ul.tasks li{ bz-gantt.gantt bz-graflow{ position: absolute; left: var(--chart-left); - top: calc(var(--row) + var(--bar-gap)); /* one header row (days grid) + bar centering gap */ + top: calc(var(--chart-top, var(--row)) + var(--bar-gap)); /* first task row, measured in refresh(), plus bar centering gap */ right: 0; bottom: 0; width: auto; /* cancel the global bz-graflow 100vw/100vh defaults, */ diff --git a/bzGantt.js b/bzGantt.js index ddd587a..87a6956 100644 --- a/bzGantt.js +++ b/bzGantt.js @@ -194,6 +194,16 @@ class BZgantt extends Buildoz { } this.style.setProperty('--tasks-width', Math.ceil(maxWidth) + 'px') + const taskLis = [...this.ul.children].slice(1) + const row = parseFloat(getComputedStyle(this).getPropertyValue('--row')) || this.rowHeight || 25 + if(taskLis[0] && taskLis[0].offsetHeight){ + this.rowHeight = taskLis[1] ? (taskLis[1].offsetTop - taskLis[0].offsetTop) : taskLis[0].offsetHeight + this.style.setProperty('--chart-top', `${taskLis[0].offsetTop}px`) + } else { + this.rowHeight = row + this.style.setProperty('--chart-top', `${row}px`) + } + const [flow, firstDate, endIdx] = this.buildFlow() let dayDate = new Date(firstDate)