From a7f701c17d841e9cbb617108575e3fed7cadaae4 Mon Sep 17 00:00:00 2001 From: Fast Dmytro <38496576+DmitryFast@users.noreply.github.com> Date: Wed, 14 Jun 2023 15:08:08 +0300 Subject: [PATCH] fix draggable content height after reinit layout (#324) --- .../draggable-layout/draggable-layout.component.ts | 12 +++++++----- apps/mobile-mzima-client/src/app/map/map.page.html | 1 + apps/mobile-mzima-client/src/app/map/map.page.ts | 6 ++++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/apps/mobile-mzima-client/src/app/map/components/draggable-layout/draggable-layout.component.ts b/apps/mobile-mzima-client/src/app/map/components/draggable-layout/draggable-layout.component.ts index 19997876ef..9d4f91294e 100644 --- a/apps/mobile-mzima-client/src/app/map/components/draggable-layout/draggable-layout.component.ts +++ b/apps/mobile-mzima-client/src/app/map/components/draggable-layout/draggable-layout.component.ts @@ -51,11 +51,6 @@ export class DraggableLayoutComponent implements AfterViewInit { } ngAfterViewInit(): void { - const checkHeight = setInterval(() => { - this.getOffsetHeight(); - if (this.fixedContentHeight) clearInterval(checkHeight); - }, 50); - setTimeout(() => { if (this.mode) { this.content.scrollToPoint( @@ -67,6 +62,13 @@ export class DraggableLayoutComponent implements AfterViewInit { }, 350); } + public updateOffsetHeight(): void { + const checkHeight = setInterval(() => { + this.getOffsetHeight(); + if (this.fixedContentHeight) clearInterval(checkHeight); + }, 50); + } + private getOffsetHeight(): void { this.fixedContentHeight = this.fixedContent.nativeElement.offsetHeight; } diff --git a/apps/mobile-mzima-client/src/app/map/map.page.html b/apps/mobile-mzima-client/src/app/map/map.page.html index e746a5fd36..e70973e009 100644 --- a/apps/mobile-mzima-client/src/app/map/map.page.html +++ b/apps/mobile-mzima-client/src/app/map/map.page.html @@ -1,4 +1,5 @@