Skip to content

Commit

Permalink
Fix table row-recalculation on panel switch
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-wolf committed Aug 23, 2024
1 parent 12af92f commit cd8973e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion erdblick_app/app/feature.panel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
}

Expand Down
4 changes: 2 additions & 2 deletions erdblick_app/app/inspection.panel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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();
}
Expand Down

0 comments on commit cd8973e

Please sign in to comment.