From cd8973ee3c65d8965410d6fa0d3dad57d031bcee Mon Sep 17 00:00:00 2001 From: Johannes Wolf Date: Fri, 23 Aug 2024 11:24:22 +0200 Subject: [PATCH] Fix table row-recalculation on panel switch --- erdblick_app/app/feature.panel.component.ts | 6 +++++- erdblick_app/app/inspection.panel.component.ts | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/erdblick_app/app/feature.panel.component.ts b/erdblick_app/app/feature.panel.component.ts index 5034925..b07cd8c 100644 --- a/erdblick_app/app/feature.panel.component.ts +++ b/erdblick_app/app/feature.panel.component.ts @@ -206,7 +206,11 @@ export class FeaturePanelComponent implements OnInit { }); this.inspectionService.inspectionPanelChanged.subscribe(() => { - this.table.scroller!.calculateOptions(); + // We have to force recalculate the tables number of visible items + setTimeout(() => { + if (this.table.scroller) + this.table.scroller.calculateOptions(); + }, 0); }) } diff --git a/erdblick_app/app/inspection.panel.component.ts b/erdblick_app/app/inspection.panel.component.ts index d227ce0..334055f 100644 --- a/erdblick_app/app/inspection.panel.component.ts +++ b/erdblick_app/app/inspection.panel.component.ts @@ -136,7 +136,7 @@ export class InspectionPanelComponent implements OnInit if (index < 0) index = this.tabs.length - 1; this.inspectionService.inspectionPanelChanged.emit(); - this.activeIndex = index + this.activeIndex = Math.max(0, index) } onGoBack(event: any) { @@ -145,7 +145,7 @@ export class InspectionPanelComponent implements OnInit const onClose = this.tabs[this.activeIndex]['onClose']; if (onClose) onClose(); - this.activeIndex = this.activeIndex - 1; + this.setTab(this.activeIndex - 1); if (this.tabs.length > 1) this.tabs.pop(); }