Merge pull request #5519 from autoboxer/master

fix #5518: prevent erros thrown by ScrollPanel loading
pull/5630/head
Tuğçe Küçükoğlu 2024-04-19 12:34:24 +03:00 committed by GitHub
commit ff20957fcb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 14 deletions

View File

@ -129,22 +129,26 @@ export default {
this.scrollYRatio = ownHeight / totalHeight; this.scrollYRatio = ownHeight / totalHeight;
this.frame = this.requestAnimationFrame(() => { this.frame = this.requestAnimationFrame(() => {
if (this.scrollXRatio >= 1) { if (this.$refs.xBar) {
this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'true'); if (this.scrollXRatio >= 1) {
!this.isUnstyled && DomHandler.addClass(this.$refs.xBar, 'p-scrollpanel-hidden'); this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'true');
} else { !this.isUnstyled && DomHandler.addClass(this.$refs.xBar, 'p-scrollpanel-hidden');
this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'false'); } else {
!this.isUnstyled && DomHandler.removeClass(this.$refs.xBar, 'p-scrollpanel-hidden'); this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'false');
this.$refs.xBar.style.cssText = 'width:' + Math.max(this.scrollXRatio * 100, 10) + '%; left:' + (this.$refs.content.scrollLeft / totalWidth) * 100 + '%;bottom:' + bottom + 'px;'; !this.isUnstyled && DomHandler.removeClass(this.$refs.xBar, 'p-scrollpanel-hidden');
this.$refs.xBar.style.cssText = 'width:' + Math.max(this.scrollXRatio * 100, 10) + '%; left:' + (this.$refs.content.scrollLeft / totalWidth) * 100 + '%;bottom:' + bottom + 'px;';
}
} }
if (this.scrollYRatio >= 1) { if (this.$refs.yBar) {
this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'true'); if (this.scrollYRatio >= 1) {
!this.isUnstyled && DomHandler.addClass(this.$refs.yBar, 'p-scrollpanel-hidden'); this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'true');
} else { !this.isUnstyled && DomHandler.addClass(this.$refs.yBar, 'p-scrollpanel-hidden');
this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'false'); } else {
!this.isUnstyled && DomHandler.removeClass(this.$refs.yBar, 'p-scrollpanel-hidden'); this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'false');
this.$refs.yBar.style.cssText = 'height:' + Math.max(this.scrollYRatio * 100, 10) + '%; top: calc(' + (this.$refs.content.scrollTop / totalHeight) * 100 + '% - ' + this.$refs.xBar.clientHeight + 'px);right:' + right + 'px;'; !this.isUnstyled && DomHandler.removeClass(this.$refs.yBar, 'p-scrollpanel-hidden');
this.$refs.yBar.style.cssText = 'height:' + Math.max(this.scrollYRatio * 100, 10) + '%; top: calc(' + (this.$refs.content.scrollTop / totalHeight) * 100 + '% - ' + this.$refs.xBar.clientHeight + 'px);right:' + right + 'px;';
}
} }
}); });
} }