virtua 0.48.0 → 0.48.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -809,22 +809,9 @@ const createScroller = (store, isHorizontal) => {
809
809
  return {
810
810
  $observe(viewport) {
811
811
  viewportElement = viewport;
812
- const clean = store.$subscribe(UPDATE_SIZE_EVENT, () => {
813
- const viewportSize = store.$getViewportSize();
814
- if (viewportSize) {
815
- const prev = viewport[scrollOffsetKey];
816
- // Detect overflowed direction after the initial viewport measurement
817
- const dummy = getCurrentDocument(viewport).createElement("div");
818
- dummy.style.cssText = `visibility:hidden;min-${isHorizontal ? "width" : "height"}:${viewportSize + 1}px`;
819
- viewport.appendChild(dummy);
820
- viewport[scrollOffsetKey] = 1;
821
- // It can be positive under some specific situations even if negative mode, so we use `<` for now.
822
- isNegative = viewport[scrollOffsetKey] < 1;
823
- viewport.removeChild(dummy);
824
- viewport[scrollOffsetKey] = prev;
825
- clean();
826
- }
827
- });
812
+ if (isHorizontal) {
813
+ isNegative = getComputedStyle(viewport).direction === "rtl";
814
+ }
828
815
  scrollObserver = createScrollObserver(store, viewport, isHorizontal, () => normalizeScrollOffset(viewport[scrollOffsetKey], isNegative), (jump, shift, isMomentumScrolling) => {
829
816
  // If we update scroll position while touching on iOS, the position will be reverted.
830
817
  // However iOS WebKit fires touch events only once at the beginning of momentum scrolling.