(force, skipRevert)
| 476 | }); |
| 477 | }, |
| 478 | _refreshAll = function _refreshAll(force, skipRevert) { |
| 479 | _docEl = _doc.documentElement; // some frameworks like Astro may cache the <body> and replace it during routing, so we'll just re-record the _docEl and _body for safety (otherwise, the markers may not get added properly). |
| 480 | |
| 481 | _body = _doc.body; |
| 482 | _root = [_win, _doc, _docEl, _body]; |
| 483 | |
| 484 | if (_lastScrollTime && !force && !_isReverted) { |
| 485 | _addListener(ScrollTrigger, "scrollEnd", _softRefresh); |
| 486 | |
| 487 | return; |
| 488 | } |
| 489 | |
| 490 | _refresh100vh(); |
| 491 | |
| 492 | _refreshingAll = ScrollTrigger.isRefreshing = true; |
| 493 | _isReverted || _recordScrollPositions(); |
| 494 | |
| 495 | var refreshInits = _dispatch("refreshInit"); |
| 496 | |
| 497 | _sort && ScrollTrigger.sort(); |
| 498 | skipRevert || _revertAll(); |
| 499 | |
| 500 | _scrollers.forEach(function (obj) { |
| 501 | if (_isFunction(obj)) { |
| 502 | obj.smooth && (obj.target.style.scrollBehavior = "auto"); // smooth scrolling interferes |
| 503 | |
| 504 | obj(0); |
| 505 | } |
| 506 | }); |
| 507 | |
| 508 | _triggers.slice(0).forEach(function (t) { |
| 509 | return t.refresh(); |
| 510 | }); // don't loop with _i because during a refresh() someone could call ScrollTrigger.update() which would iterate through _i resulting in a skip. |
| 511 | |
| 512 | |
| 513 | _isReverted = false; |
| 514 | |
| 515 | _triggers.forEach(function (t) { |
| 516 | // nested pins (pinnedContainer) with pinSpacing may expand the container, so we must accommodate that here. |
| 517 | if (t._subPinOffset && t.pin) { |
| 518 | var prop = t.vars.horizontal ? "offsetWidth" : "offsetHeight", |
| 519 | original = t.pin[prop]; |
| 520 | t.revert(true, 1); |
| 521 | t.adjustPinSpacing(t.pin[prop] - original); |
| 522 | t.refresh(); |
| 523 | } |
| 524 | }); |
| 525 | |
| 526 | _clampingMax = 1; // pinSpacing might be propping a page open, thus when we .setPositions() to clamp a ScrollTrigger's end we should leave the pinSpacing alone. That's what this flag is for. |
| 527 | |
| 528 | _hideAllMarkers(true); |
| 529 | |
| 530 | _triggers.forEach(function (t) { |
| 531 | // the scroller's max scroll position may change after all the ScrollTriggers refreshed (like pinning could push it down), so we need to loop back and correct any with end: "max". Same for anything with a clamped end |
| 532 | var max = _maxScroll(t.scroller, t._dir), |
| 533 | endClamp = t.vars.end === "max" || t._endClamp && t.end > max, |
| 534 | startClamp = t._startClamp && t.start >= max; |
| 535 |
no test coverage detected
searching dependent graphs…