Skip to content

Commit c205b08

Browse files
committed
fix: prevent measurement jitter when scale is applied
1 parent dd5b49a commit c205b08

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

packages/virtual-core/src/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,9 @@ export const measureElement = <TItemElement extends Element>(
251251
return size
252252
}
253253
}
254-
return Math.round(
255-
element.getBoundingClientRect()[
256-
instance.options.horizontal ? 'width' : 'height'
257-
],
258-
)
254+
255+
const target = element as unknown as HTMLElement
256+
return target[instance.options.horizontal ? 'offsetWidth' : 'offsetHeight']
259257
}
260258

261259
export const windowScroll = <T extends Window>(

0 commit comments

Comments
 (0)