Round grid scroll wrapper offsets to the nearest pixel
This commit is contained in:
parent
8e83046321
commit
c62e6d776c
|
@ -27,9 +27,11 @@
|
||||||
$: style = generateStyle($scroll, $rowHeight)
|
$: style = generateStyle($scroll, $rowHeight)
|
||||||
|
|
||||||
const generateStyle = (scroll, rowHeight) => {
|
const generateStyle = (scroll, rowHeight) => {
|
||||||
const offsetX = scrollHorizontally ? -1 * scroll.left : 0
|
const offsetX = Math.round(scrollHorizontally ? -1 * scroll.left : 0)
|
||||||
const offsetY = scrollVertically ? -1 * (scroll.top % rowHeight) : 0
|
const offsetY = Math.round(
|
||||||
return `transform: translate3d(${offsetX}px, ${offsetY}px, 0);`
|
scrollVertically ? -1 * (scroll.top % rowHeight) : 0
|
||||||
|
)
|
||||||
|
return `transform: translate(${offsetX}px, ${offsetY}px);`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handles a mouse wheel event and updates scroll state
|
// Handles a mouse wheel event and updates scroll state
|
||||||
|
|
Loading…
Reference in New Issue