-
Notifications
You must be signed in to change notification settings - Fork 705
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
ScrollViewer / Scroller doesn't re-rasterize the content after a zoom #541
Comments
@jevansaks, is this bug on the team's radar? So far I've been changing the DpiScale of my scrolled control according to the ZoomFactor of the Scroller but it seems DpiScale doesn't work well with values greater than 10 for instance... what would be the right thing to do here, resize the scrolled control? |
I believe @RBrid is working his way through these issues, so I'll let him comment. |
@adrientetar, what do you see happening at scale factors larger than 10? And, the DpiScale you're referring to is the property on the Win2D CanvasControl, right? |
@micahl Yes, I use CanvasVirtualControl. There's a value out of range traceback with value greater than 10 dot something iirc, here I got 12 by scrolling in with the touchpad (does not repro consistently I think). For now I clamp to 10 but I'm wondering what the right thing to do is here. |
Hmm... we looked into this issue a little while back to understand why the Scroller wasn't re-rasterizing content after a zoom. IIRC, the way we're hooking up the content's Scale property to the output of the InteractionTracker.Scale causes it to be treated as a long-running animation that runs independent and we'd need to stop/start it again during Idle to trigger the re-rasterization. I haven't played enough with CanvasVirtualControl to know its behavior, but perhaps once this bug is fixed then it will render correctly without needing to set a DpiScale? @shawnhar are there limitations with zooming and CanvasVirtualControl? The InteractionTracker-based Scroller in WinUI doesn't have the min/max zoom factor limits that the old ScrollViewer control has. Will that be problematic with CanvasVirtualControl? |
CanvasVirtualControl doesn't have any specific limits of its own beyond the underlying DComp virtual surface image source max size (which is what it wraps). Certainly nothing as small as a 10x limit. It's important to keep control of rasterization DPI + zoom factors, though, as bad combinations of these can easily exceed DComp limits on how many tiles can be visible at one time. If you're re-rasterizing in the middle of a zoom without adjusting these ratios, it's surprising how fast changes in zoom amount can end up requesting Win2D to rasterize gigabytes worth of image data (which is never going to work). |
@adrientetar, try reducing the height/width being set on the CanvasVirtualControl. Sounds like you may also want to wait to invalidate the canvas until the scroller state hits idle. Take a look at the StateChanged event. |
After further investigation we found that the change to enable the correct behavior on RS4 (1803) and earlier releases isn't a change in the scroller control, but rather would require a change in the framework's rendering logic. We've fixed it for RS5+. Until we finish decoupling the framework from the OS (detailed announced in the //build 2019 talk on the State of the Union: The Windows Presentation Platform talk), we'll have this limitation on releases prior to RS5. |
🎉This issue was addressed in #669, which has now been successfully released as Handy links: |
@micahl So I just tried this in the new prerelease. Now the Scroller does rasterize on its own, but I see white flashes at regular intervals when I zoom in/out, which I didn't have before. |
@adrientetar thanks for bringing this up. I'll reopen and let Regis investigate. What OS version are you running on? 1809 or 1903? |
@jevansaks, 1903. Here's a video of what I'm seeing, my only change was removing the call to Invalidate() the canvas on ViewChanged. |
🎉This issue was addressed in #882, which has now been successfully released as Handy links: |
Okay I just tried 2.2.190702001-prerelease, it's better than before (no flashes now) but with the zoom inertia it can take a couple seconds after I stop zooming with my touchpad before it redraws... I'll probably disable inertia altogether but perhaps there's room for improvement there? I can provide a video if it helps. |
Hello @adrientetar, le Parisien. Thanks for checking my changes & for your feedback. At the moment, I can't think of a way around this because whether in inertia or driven by input, the Scroller can't re-rasterize in the middle of the ongoing manipulation without a major visual glitch. I will keep this unfortunate experience in mind in case a better approach surfaces. Merci. |
Describe the bug
ScrollViewer/Scroller doesn't re-rasterize the content after a zoom
Steps to reproduce the bug
Steps to reproduce the behavior:
Expected behavior
The content may appear fuzzy while a zoom is in progress, but it should re-rasterize when the zoom completes.
Version Info
NuGet package version:
2.1.190319001-prerelease
Additional context
The text was updated successfully, but these errors were encountered: