modal: fix restoring state when recreated

This commit is contained in:
jean-emmanuel 2022-02-27 09:12:14 +01:00
parent d12716d18f
commit 1175374341
3 changed files with 11 additions and 1 deletions

View file

@ -1,5 +1,10 @@
# Changelog
## 1.15.2
- bug fixes
- modal: scroll state not restored when the modal container is recreated
## 1.15.1
- bug fixes

View file

@ -141,7 +141,7 @@ function updateWidget(widget, options={}) {
if (stateManager.queueCounter === 0) {
for (let id in scrollState) {
for (let w of widgetManager.getWidgetById(id)) {
if (w.getProp('scroll')) w.setScroll(scrollState[id])
if (w.getProp('scroll')) w.setScroll(scrollState[id][0], scrollState[id][1])
}
}
}

View file

@ -268,7 +268,12 @@ class Modal extends Panel {
}
setScroll(x, y) {
if (x !== undefined) this.popupContent.firstChild.scrollLeft = this.scroll[0] = x
if (y !== undefined) this.popupContent.firstChild.scrollTop = this.scroll[1] = y
}
}