Fix reverse scroll bar scrolling with bar pull (#6968)
Some checks are pending
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina 2024-10-17 14:03:09 +04:00 committed by GitHub
parent 7d91ffee77
commit 23027deb17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -194,8 +194,13 @@
const topBar = Y - rectScroll.y - shiftTop - 2
const heightScroll = rectScroll.height - 4 - divBar.clientHeight - shiftTop - shiftBottom
const procBar = topBar / heightScroll
divScroll.scrollTop = (divScroll.scrollHeight - divScroll.clientHeight) * procBar
} else {
if (scrollDirection === 'vertical-reverse') {
divScroll.scrollTop = (divScroll.scrollHeight - divScroll.clientHeight) * (procBar - 1)
} else {
divScroll.scrollTop = (divScroll.scrollHeight - divScroll.clientHeight) * procBar
}
} else if (isScrolling === 'horizontal') {
let X = event.clientX - dXY
if (X < rectScroll.left + 2 + shiftLeft) X = rectScroll.left + 2 + shiftLeft
if (X > rectScroll.right - divBarH.clientWidth - (mask !== 'none' ? 12 : 2) - shiftRight) {
@ -513,7 +518,11 @@
divBar.style.top = `${topBar}px`
const heightScroll = rectScroll.height - 4 - barHeight - shiftTop - shiftBottom
const procBar = (topBar - rectScroll.top - shiftTop - 2) / heightScroll
divScroll.scrollTop = (divScroll.scrollHeight - divScroll.clientHeight) * procBar
if (scrollDirection === 'vertical-reverse') {
divScroll.scrollTop = (divScroll.scrollHeight - divScroll.clientHeight) * (procBar - 1)
} else {
divScroll.scrollTop = (divScroll.scrollHeight - divScroll.clientHeight) * procBar
}
}
}
@ -655,6 +664,7 @@
<div
class="bar"
class:hovered={isScrolling === 'vertical'}
class:reverse={scrollDirection === 'vertical-reverse'}
bind:this={divBar}
on:mousedown|stopPropagation={(ev) => {
onScrollStart(ev, 'vertical')
@ -895,6 +905,11 @@
max-height: calc(100% - 12px);
transform: scaleX(0.5);
&.reverse {
top: auto;
bottom: 2px;
}
&:hover,
&.hovered {
transform: scaleX(1);