Revert "pref: use translateY instead of traditional layout positioning (#639)" (#655)

This reverts commit bc476a5e4f.
This commit is contained in:
xylight authored and GitHub committed 2025-09-12 03:55:32 +00:00
1 parent bc476a5e4f
commit abe54ad113
2 files changed
+6 -16

No files matched your search

@@ -45,7 +45,6 @@
overscan={5} overscan={5}
estimatedHeight={500} estimatedHeight={500}
items={nodes} items={nodes}
useGpu={false}
{initialOffset} {initialOffset}
> >
{#snippet item(index)} {#snippet item(index)}
+6 -15
View File
@@ -19,7 +19,6 @@
debounceResize?: number debounceResize?: number
useWindow?: boolean useWindow?: boolean
height?: number height?: number
useGpu?: boolean
} }
let { let {
@@ -32,7 +31,6 @@
debounceResize = 100, debounceResize = 100,
useWindow = true, useWindow = true,
height = 0, height = 0,
useGpu = true,
...rest ...rest
}: Props = $props() }: Props = $props()
@@ -113,6 +111,7 @@
function updateVisibleItems() { function updateVisibleItems() {
if (!virtualListEl) return [] if (!virtualListEl) return []
viewportHeight = innerHeight?.current ?? 1000 viewportHeight = innerHeight?.current ?? 1000
const scrollTop = scrollY - initialOffset const scrollTop = scrollY - initialOffset
@@ -224,22 +223,14 @@
if (!useWindow) scrollY = virtualListEl?.scrollTop ?? 0 if (!useWindow) scrollY = virtualListEl?.scrollTop ?? 0
}} }}
> >
{#if !useGpu} <div
<div style="height: {cumulativeItemHeights[visibleItems?.[0]?.index - 1] ||
style="height: {cumulativeItemHeights[visibleItems?.[0]?.index - 1] || 0}px; border: 0 !important;"
0}px; border: 0 !important;" ></div>
></div>
{/if}
{#each visibleItems as item (item.index)} {#each visibleItems as item (item.index)}
<div <div
data-index={item.index} data-index={item.index}
class={[ class="post-container fix-divide group/virtual"
'post-container fix-divide group/virtual w-full',
useGpu && 'absolute',
]}
style="{useGpu
? `transform: translateY(${item.offset}px);`
: ''} will-change: transform;"
use:resizeObserver use:resizeObserver
> >
{@render itemSnippet(item.index)} {@render itemSnippet(item.index)}