Fix jumping Scroller (#2305)

Signed-off-by: Alexander Platov <sas_lord@mail.ru>
This commit is contained in:
Alexander Platov 2022-10-14 09:13:18 +03:00 committed by GitHub
parent 4304066083
commit c808457c30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -27,4 +27,4 @@
"Enum": "Справочник",
"Members": "Участники"
}
}
}

View File

@ -13,7 +13,7 @@
// limitations under the License.
-->
<script lang="ts">
import { onDestroy, onMount } from 'svelte'
import { beforeUpdate, afterUpdate, onDestroy, onMount } from 'svelte'
import { resizeObserver } from '../resize'
import { themeStore as themeOptions } from '@hcengineering/theme'
import type { FadeOptions } from '../types'
@ -203,6 +203,16 @@
if (divScroll) divScroll.removeEventListener('scroll', checkFade)
})
let oldTop: number
beforeUpdate(() => {
if (divBox && divScroll) oldTop = divScroll.scrollTop
})
afterUpdate(() => {
if (divBox && divScroll) {
if (oldTop !== divScroll.scrollTop) divScroll.scrollTop = oldTop
}
})
let divHeight: number
const _resize = (): void => checkFade()