Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Base width on the header as it already has its final width while those of the timeline content will change afterwards

Henriette Dinger4e3d50b2e6e2
diff --git a/frontend/src/app/components/wp-table/timeline/container/wp-timeline-container.directive.ts b/frontend/src/app/components/wp-table/timeline/container/wp-timeline-container.directive.ts
index 1ad42ad8aac..3b260fec35e 100644
--- a/frontend/src/app/components/wp-table/timeline/container/wp-timeline-container.directive.ts
+++ b/frontend/src/app/components/wp-table/timeline/container/wp-timeline-container.directive.ts
@@ -60,6 +60,7 @@ import {debugLog, timeOutput} from "core-app/helpers/debug_output";
import {RenderedWorkPackage} from "core-app/modules/work_packages/render-info/rendered-work-package.type";
import {HalEventsService} from "core-app/modules/hal/services/hal-events.service";
import {WorkPackageNotificationService} from "core-app/modules/work_packages/notifications/work-package-notification.service";
+import {timelineHeaderSelector} from "core-components/wp-table/timeline/header/wp-timeline-header.directive";
@Component({
selector: 'wp-timeline-container',
@@ -237,8 +238,9 @@ export class WorkPackageTimelineTableController implements AfterViewInit, OnDest
});
// Calculate overflowing width to set to outer container
- // required to match width in all child divs
- const currentWidth = this.getParentScrollContainer().scrollWidth;
+ // required to match width in all child divs.
+ // The header is the only one reliable, as it already has the final width.
+ const currentWidth = this.$element.find(timelineHeaderSelector)[0].scrollWidth;
this.outerContainer.width(currentWidth);
});
}
diff --git a/frontend/src/app/components/wp-table/timeline/header/wp-timeline-header.directive.ts b/frontend/src/app/components/wp-table/timeline/header/wp-timeline-header.directive.ts
index dc19a4c04b4..e4153343ff2 100644
--- a/frontend/src/app/components/wp-table/timeline/header/wp-timeline-header.directive.ts
+++ b/frontend/src/app/components/wp-table/timeline/header/wp-timeline-header.directive.ts
@@ -37,9 +37,10 @@ import {WorkPackageViewTimelineService} from "core-app/modules/work_packages/rou
export const timelineHeaderCSSClass = 'wp-timeline--header-element';
+export const timelineHeaderSelector = 'wp-timeline-header';
@Component({
- selector: 'wp-timeline-header',
+ selector: timelineHeaderSelector,
templateUrl: './wp-timeline-header.html'
})
export class WorkPackageTimelineHeaderController implements OnInit {