scrollbar: fix init state when recreating panel

This commit is contained in:
jean-emmanuel 2025-09-22 11:50:34 +02:00
parent 9c5ad33944
commit edca21bb99

View file

@ -155,8 +155,13 @@ export default class Scrollbar extends StaticProperties(Fader, {
this.thumbSize = this.scrollTarget.scrollThumb[index]
this.cssVars.knobSize = Math.max(this.thumbSize * size, 30)
if (this.scrollTarget.scroll[index] != this.value) {
this.setValue(this.scrollTarget.scroll[index], {fromScrollEvent:true, send:!init, sync:!init})
if (init && this.value) {
// panel (re)createed: restore scroll state
this.setValue(this.value, {fromScrollEvent: false, send: false, sync: false})
} else if (this.scrollTarget.scroll[index] != this.value) {
// panel scrolling: update scroll state
this.setValue(this.scrollTarget.scroll[index], {fromScrollEvent: true, send: !init, sync: !init})
}
}