-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added patch for virtualizer height fix
- Loading branch information
Showing
5 changed files
with
74 additions
and
8 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
.yarn/patches/@lit-labs-virtualizer-npm-2.0.14-58a3230753.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
diff --git a/layouts/flow.js b/layouts/flow.js | ||
index 77ea288c5525ac46221c709f9eb97d8f5da14aeb..ecbfd5a38085b0688b912790b4f86f1fdf8798db 100644 | ||
--- a/layouts/flow.js | ||
+++ b/layouts/flow.js | ||
@@ -200,9 +200,13 @@ export class FlowLayout extends BaseLayout { | ||
if (this._last < 0) { | ||
return this._calculateAnchor(lower, upper); | ||
} | ||
+ if (this._last > this.items.length - 1) { | ||
+ return this._calculateAnchor(lower, upper); | ||
+ } | ||
const firstItem = this._getPhysicalItem(this._first), lastItem = this._getPhysicalItem(this._last), firstMin = firstItem.pos, lastMin = lastItem.pos, lastMax = lastMin + this._metricsCache.getChildSize(this._last); | ||
if (lastMax < lower) { | ||
// Window is entirely past physical items, calculate new anchor | ||
+ | ||
return this._calculateAnchor(lower, upper); | ||
} | ||
if (firstMin > upper) { | ||
@@ -229,9 +233,13 @@ export class FlowLayout extends BaseLayout { | ||
} | ||
else { | ||
this._getItems(); | ||
+ // We may be able to calculate scroll size more accurately after | ||
+ // processing the latest measurements | ||
+ this._refineScrollSize(); | ||
} | ||
} | ||
/** | ||
+ | ||
* Sets the range to empty. | ||
*/ | ||
_clearItems() { | ||
@@ -395,8 +403,19 @@ export class FlowLayout extends BaseLayout { | ||
} | ||
_updateScrollSize() { | ||
const { averageMarginSize } = this._metricsCache; | ||
- this._scrollSize = Math.max(1, this.items.length * (averageMarginSize + this._getAverageSize()) + | ||
- averageMarginSize); | ||
+ this._scrollSize = | ||
+ this.items.length * (averageMarginSize + this._getAverageSize()) + | ||
+ averageMarginSize; | ||
+ } | ||
+ _refineScrollSize() { | ||
+ // If all items are rendered, we can calculate the scroll size exactly | ||
+ if (this._first === 0 && this._last === this.items.length - 1) { | ||
+ this._scrollSize = this._physicalMax - this._physicalMin; | ||
+ } | ||
+ // Otherwise, we re-estimate with latest measurements | ||
+ else { | ||
+ this._updateScrollSize(); | ||
+ } | ||
} | ||
/** | ||
* Returns the average size (precise or estimated) of an item in the scrolling direction, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters