-
Notifications
You must be signed in to change notification settings - Fork 28.1k
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
Smooth Scrolling not working on HiDPI displays if Display Scaling is higher than 100% #35711
Comments
UPDATE: My setup is a laptop with a second screen plugged in via HDMI. I've noticed that the smooth scrolling actually works on the external screen (100%) and it stops working as soon as I drag VScode on my laptop screen (150%). Once I drag it back to the external screen (100%) it works again. Then if I change the laptop's scaling to 100%, it works on this too. So the problem here seems to be the smooth scrolling not working with a scaling bigger than 100%. Why is that? Scaling at 100%:Scaling at 150%: |
The root problem is that we receive a There is no way (flag or anything really) on those events to distinguish a scroll that occurs on the touch pad vs. a scroll that occurs on a physical mouse wheel. We should not begin any form of smooth scrolling on our side when scrolling with the touchpad because the touchpad itself emits already smooth scrolling events, and us applying our animation on top of it results in subtle, weird, nausea-inducing scrolling. We therefore have a MouseWheelClassifier which tries to classify a series of I have recorded a set of mice and what sort of properties their That is what is implemented in _computeScore and in the tests at MouseWheelClassifier My instinct is that, for you, the This is a very tricky problem, as we simply lack the needed information on the |
Thanks @alexandrudima for taking the time to write down such a detailed explanation! Everything you said makes perfect sense. I'm really sorry but unfortunately I lack the skills needed to come up with any idea. I just thought it would have been useful for the community to point this problem out. Hopefully, one day, someone more skilled than me will be able to address this minor issue :) Thank you! |
Parameter "editor.smoothScrolling" is disabled by default in settings and smooth scroll works perfectly with touchpad. Maybe add comment to use this parameter for mouse wheel only and force using smooth scrolling without checking scroll type? Because all modern screens has big resolution and most people using screen scaling. And smooth scroll didn't work in this case. Playing with "--force-device-scale-factor=1.0" and "window.zoomLevel" works but small menus and dialogs looking terrible. |
Any news on this issue? |
There are a lot of users who will never use a touchpad to scroll in vscode. What about having a setting for those, so that smooth scrolling also works with 4k monitors? |
Same problem experienced here 🙋♂️. Smooth when scaling is 100%, rigid when scaling is higher. Probably should use the smooth scrolling experience that is used for Microsoft Word itself because it works on whatever scaling (maybe re-use the code or something? Idk). |
just use --force-device-scale-factor=1.0 and scale with window.zoomLevel instead. Vscode now renders its own menus and popups, so everything gets scaled properly. |
I see, interesting. Also, how will I launch Visual Studio Code with that setting? Through Command Prompt? If yes, is there a way to launch Visual Studio Code with that setting every single time without using command prompt (or any other command-line interface)?
UPDATE: Ok, so I know how to launch Visual Studio Code the way I want using flags, but... how do I make it so that it will run with that settings everytime Visual Studio Code is launched? I have a shortcut that targets the executable so... I have to go into the compatibility settings?
|
Any news on this? Trying the |
More and more Windows devices (laptops and desktops alike) have 1080p monitors, where 125% scaling is default, and is required (at least on laptops) to view elements (100% scaling is too small). This is a bug which affects all laptops with 1080p screens by default. Surprisingly, the Extension pages scroll smoothly, just the actual text files and the Settings UI does not follow the smooth scrolling flag. Any news on this? Adding flags to shortcuts is possible, but I think an option should be provided to do that within the UI itself as a workaround until this issue is fixed. This issue still persists in Version 1.36.1. |
also the --force-device-scale-factor=1.0 workaround doesnt work for multiple displays with different DPI. And even then having to constantly switch back and forth when im either on my laptop or have an external monitor plugged in is annoying. Chrome/Chromium scrolls just fine with every DPI combination imaginable. |
@alexandrudima Are you talking about Windows Precision touchpads only? I have a Lenovo Z50-70 which has a Synaptics touchpad. There is no smooth scrolling built into the touchpad and I've toggled all the available settings and seen no difference. This is evident when I use apps like Notepad or Acrobat Reader DC, the scrolling is choppy, and it does not feel any different when I use my mouse, except that the mouse scroll wheel causes text to move in groups of 3 lines, while in touchpads it can be made to much more precisely (which is what I think you mean with lower values of @solid-pixel Is it possible to rename the post to something like "Smooth Scrolling does not work in HIDPI displays with display scaling > 100%"? The current title is kind of misleading and makes the issue seem like an obscure and specific issue, which it isn't. |
@SubhamSatyajeet you're right, I've updated it. I didn't know in the beginning what caused it so that's why the generic title. Thanks for pointing that ou! |
Using |
This was my understanding as well. Yes, Logitech touchpads for example will have a separate option for 'smooth scrolling' which does indeed give an obnoxiously 'floaty' feel to apps which already incorporate it (such as any web browser), which is why I turn it off - and in that case, it's only available if the Logitech Options is installed and by default does not incorporate any additional smooth scrolling. I'm not aware by default any touchpad adding smooth scrolling out of the gate, but that may just be my limited experience with different vendors. Regardless of the complexities, hopefully this can be resolved as using display scaling is exceedingly common now. The smooth scrolling is so much better, but unfortunately due to two 4K displays with 150% scaling I can't really take advantage of it. |
我遇到了相同的问题,期待修复 |
Please correct me if I'm saying something really, really dumb, but if this is the only issue, wouldn't it be enough to replace this line with Edit: any update on this, @alexdima? |
I confirm that it affects Linux as well. Ubuntu 18.04 on ASUS ZenBook UX430UA here, Visual Studio Code installed from the official deb package. More information:
I am using Large Text, which is equal to 1.25 font scaling. Once I turn it off, the mouse scroll animation works properly. The touchpad scroll animation works properly in both cases. Should I be of any help, feel free to let me know... 🚀 Unfortunately, I do not understand TypeScript... 😄 |
Experiencing the same bug on a 4k screen. Windows 10 |
The bug should be fixed by applying the inverse of DPI scaling to mouse events per @alexdima's bug explanation. This is probably what @DamianoMagrini just said. Might need a little rounding to get crisp integers. I can't try it myself. |
@JVimes yes, that's the idea. In the next few days (weeks, at most), I'll fork this repo and see if I can fix it myself. If so, I'll submit a PR. |
@JVimes @DamianoMagrini For Windows: just replace |
Thank you for this simple fix idea! @JVimes @DamianoMagrini @krlvm |
@alexdima |
The commit modified scrollableElement.ts, which listens Indeed, this will have effect only on Windows systems, but the issue can be reproduced on other systems, including all Linux distributions and macOS. I can reproduce the issue right now on Ubuntu 20.04. @alexdima, @DamianoMagrini fix works on Linux too (Ubuntu 20.04, 120 DPI, .deb package): replace
|
Thanks for the fix! However, with that fix in effect, I noticed that when I set the zoom setting ( |
Reopening since there are two problems left:
|
Taking about Linux (and, perhaps, macOS), I assume the problem is with floating-point numbers and scroll behavior on Linux. I did some research with GNOME, KDE and Xfce, and probably know how to fix it, I'll make a pull request:
|
I've submitted a pull request |
One of the recent Insiders updates seems to have made the launch flag |
* Take `window.zoomLevel` into account, as it impacts `window.devicePixelRatio` * Include linux in the check
Steps to Reproduce:
Reproduces without extensions: Yes (tried to launch with code --disable-extensions, same issue)
To be honest I don't know whether this is an issue related to this specific version as it's the first time I'm using VS Code.
My mouse is an MX Master and I'm using an ASUS N550 laptop.
Anybody else experiencing this issue?
Thanks
The text was updated successfully, but these errors were encountered: