From be4645b6ecc493d2051906f9262e3cd6fc1f6fcc Mon Sep 17 00:00:00 2001 From: Bramus Date: Thu, 28 Dec 2023 23:11:09 +0100 Subject: [PATCH] Use cached sourceMeasurements instead of recomputing style --- src/scroll-timeline-base.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/scroll-timeline-base.js b/src/scroll-timeline-base.js index 798f46f4..1f8d91e8 100644 --- a/src/scroll-timeline-base.js +++ b/src/scroll-timeline-base.js @@ -481,11 +481,10 @@ export class ScrollTimeline { // Calculate the fractional offset of a range value relative to the full range. relativePosition(value, details) { const { axis, source } = details.timeline; + const { sourceMeasurements } = sourceDetails.get(source); - // @TODO: Make use of sourceMeasurements here, yet these don’t seem to be stored - const style = getComputedStyle(source); let sourceScrollDistance = undefined; - if (normalizeAxis(axis, style) === 'x') { + if (normalizeAxis(axis, sourceMeasurements) === 'x') { sourceScrollDistance = source.scrollWidth; } else { sourceScrollDistance = source.scrollHeight;