2
0
Fork 0

Merge pull request #4055 from NoelDeMartin/MOBILE-4470

MOBILE-4470 core: Fix collapsible header scrolling
main
Pau Ferrer Ocaña 2024-05-22 11:56:07 +02:00 committed by GitHub
commit 24aeb1dfc1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 7 deletions

View File

@ -512,9 +512,7 @@ export class CoreCollapsibleHeaderDirective implements OnInit, OnChanges, OnDest
this.content = content; this.content = content;
const page = this.page; const page = this.page;
const scrollingHeight = this.scrollingHeight;
const expandedHeader = this.expandedHeader; const expandedHeader = this.expandedHeader;
const expandedHeaderHeight = this.expandedHeaderHeight;
const expandedFontStyles = this.expandedFontStyles; const expandedFontStyles = this.expandedFontStyles;
const collapsedFontStyles = this.collapsedFontStyles; const collapsedFontStyles = this.collapsedFontStyles;
const floatingTitle = this.floatingTitle; const floatingTitle = this.floatingTitle;
@ -522,9 +520,7 @@ export class CoreCollapsibleHeaderDirective implements OnInit, OnChanges, OnDest
if ( if (
!page || !page ||
!scrollingHeight ||
!expandedHeader || !expandedHeader ||
!expandedHeaderHeight ||
!expandedFontStyles || !expandedFontStyles ||
!collapsedFontStyles || !collapsedFontStyles ||
!floatingTitle !floatingTitle
@ -543,7 +539,7 @@ export class CoreCollapsibleHeaderDirective implements OnInit, OnChanges, OnDest
this.content.scrollEvents = true; this.content.scrollEvents = true;
this.content.addEventListener('ionScroll', this.contentScrollListener = ({ target }: CustomEvent<ScrollDetail>): void => { this.content.addEventListener('ionScroll', this.contentScrollListener = ({ target }: CustomEvent<ScrollDetail>): void => {
if (target !== this.content || !this.enabled) { if (target !== this.content || !this.enabled || !this.scrollingHeight) {
return; return;
} }
@ -551,7 +547,7 @@ export class CoreCollapsibleHeaderDirective implements OnInit, OnChanges, OnDest
const progress = frozen const progress = frozen
? 0 ? 0
: CoreMath.clamp(contentScroll.scrollTop / scrollingHeight, 0, 1); : CoreMath.clamp(contentScroll.scrollTop / this.scrollingHeight, 0, 1);
this.setCollapsed(progress === 1); this.setCollapsed(progress === 1);
page.style.setProperty('--collapsible-header-progress', `${progress}`); page.style.setProperty('--collapsible-header-progress', `${progress}`);
@ -608,7 +604,6 @@ export class CoreCollapsibleHeaderDirective implements OnInit, OnChanges, OnDest
const scrollingHeight = this.scrollingHeight ?? 0; const scrollingHeight = this.scrollingHeight ?? 0;
const expandedHeaderClientHeight = this.expandedHeader?.clientHeight ?? 0; const expandedHeaderClientHeight = this.expandedHeader?.clientHeight ?? 0;
const expandedHeaderHeight = this.expandedHeaderHeight ?? 0; const expandedHeaderHeight = this.expandedHeaderHeight ?? 0;
const scrollableHeight = contentScroll.scrollHeight - contentScroll.clientHeight; const scrollableHeight = contentScroll.scrollHeight - contentScroll.clientHeight;
let frozen = false; let frozen = false;