diff --git a/CHANGELOG.md b/CHANGELOG.md index 117ac410..22fafc24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - bug fixes - client options specified in server config not working unless lowercased - make disconnection detection less aggressive (don't display notification if reconnection succeeds quickly) + - panel: initial scroll state issue ## 1.11.0 diff --git a/src/client/widgets/containers/panel.js b/src/client/widgets/containers/panel.js index 3b8fda6b..0c3b0a84 100644 --- a/src/client/widgets/containers/panel.js +++ b/src/client/widgets/containers/panel.js @@ -135,14 +135,19 @@ class Panel extends Container() { if (this.props.type !== 'modal') { + this.value = [0, 0] this.scrollWidth = 1 this.scrollHeight = 1 + setTimeout(()=>{ + this.scrollWidth = this.widget.scrollWidth - this.widget.clientWidth + this.scrollHeight = this.widget.scrollHeight - this.widget.clientHeight + }) this.scrollTimeout = null this.widget.addEventListener('scroll', ()=>{ this.scrollWidth = this.widget.scrollWidth - this.widget.clientWidth this.scrollHeight = this.widget.scrollHeight - this.widget.clientHeight - var x = this.widget.scrollLeft / this.scrollWidth, - y = this.widget.scrollTop / this.scrollHeight + var x = this.widget.scrollLeft / this.scrollWidth || 0, + y = this.widget.scrollTop / this.scrollHeight || 0 if (iOS13) { if (this.iosScrollbars.horizontal._scrollable) this.iosScrollbars.horizontal.setValue(x) if (this.iosScrollbars.vertical._scrollable) this.iosScrollbars.vertical.setValue(y)