Skip to content

Commit

Permalink
Use cached sourceMeasurements instead of recomputing style
Browse files Browse the repository at this point in the history
  • Loading branch information
bramus committed Dec 28, 2023
1 parent 46b91b2 commit be4645b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/scroll-timeline-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit be4645b

Please sign in to comment.