-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(cdk/virtual-scroll): fix subpixel rounding errors on hdpi screens #16269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -9,4 +9,6 @@ | |||
Spacer used to force the scrolling container to the correct size for the *total* number of items | |||
so that the scrollbar captures the size of the entire data set. | |||
--> | |||
<div class="cdk-virtual-scroll-spacer" [style.transform]="_totalContentSizeTransform"></div> | |||
<div class="cdk-virtual-scroll-spacer" | |||
[style.width]="orientation == 'horizontal' ? _totalContentSize + 'px' : ''" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: it might be micro-optimizing a bit, but would it make sense to have this logic inside the component when setting _totalContentSize
? Otherwise Angular will run the ternary and the string concatenation on each change detection run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, probably a good idea
Using `transform` appears to cause rounding errors that can accumulate and become significant after scrolling through a large number of items. Switching to `width` / `height` corrects this.
* fix(cdk/virtual-scroll): fix subpixel rounding errors on hdpi screens Using `transform` appears to cause rounding errors that can accumulate and become significant after scrolling through a large number of items. Switching to `width` / `height` corrects this. * don't recalulate height/width during every change detection (cherry picked from commit b796b6e)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Using
transform
appears to cause rounding errors that can accumulate andbecome significant after scrolling through a large number of items.
Switching to
width
/height
corrects this.