intellij-pdf-viewer icon indicating copy to clipboard operation
intellij-pdf-viewer copied to clipboard

Scrolling on mac has high delay

Open AndyDekiert opened this issue 1 year ago • 33 comments

With Version 0.17.0, IntelliJ Idea 2024.2.3 and macOS 14.6.1, the scrolling of the PDF with the built-in touchpad is extremely slow and has a delay. When trying to scroll more than a couple of lines, the PDF viewer is still receiving and handling input seconds after the input stopped. The viewer may even change the direction of the scrolling after the input has stopped. So it is not like the viewer continues to scroll slowly but is actually still handling the queued input events.

Scrolling in all other windows and the editor of IntelliJ works as expected, only the PDF viewer is affected.

AndyDekiert avatar Oct 18 '24 13:10 AndyDekiert

Adding to this: using the arrow keys or the scroll bar works without lag.

willipreuk avatar Oct 19 '24 13:10 willipreuk

Thanks for reporting this, we had this problem in the past (#51) but apparently it has come back. I don't have a Mac to test this with, so this may take a while to fix.

We are not listening directly for scroll wheel events anymore (causing slow callbacks), but possibly other events are causing this. Could you try these versions? intellij-pdf-viewer-0.17.1-alpha.1.1.zip intellij-pdf-viewer-0.17.1-alpha.1.2.zip intellij-pdf-viewer-0.17.1-alpha.1.3.zip

Is the problem also there if you right-click the pdf and select 'open in embedded browser'? If you do not see a context menu, it may help to go to Help > Find Action, search for Registry, set pdf.viewer.use.jcef.osr.view to false, and restart. See IJPL-59459 for more details.

PHPirates avatar Oct 21 '24 07:10 PHPirates

Hey, thank you for your effort! I have tried the alpha versions and sadly saw no improvement, the issue is also present in the embedded browser view.

willipreuk avatar Oct 23 '24 09:10 willipreuk

Hey, I am sorry for the late response. Unfortunately I can confirm @willipreuk result's with the three alpha versions and the embedded browser view.

AndyDekiert avatar Oct 23 '24 13:10 AndyDekiert

I just installed version 0.16.0 from the GitHub releases page and it is working fine. So, the issue must be related to some of the changes between 0.16.0 and 0.17.0.

AndyDekiert avatar Oct 23 '24 13:10 AndyDekiert

Thanks for testing! Interesting, so if it's also there in the embedded pdfium it may be something on the plugin side. Unfortunately so many things changed between 0.16 and 0.17 it will be hard to do a bisection, in particular because as said I don't have an iOS to test with.

We can still run a profiler to see where the issue is. For the browser part,

  • Search (double shift) for Registry, and enable pdf.viewer.debug (you can search here)
  • right-click on the pdf and open devtools, or search (double shift) for "Open DevTools"
  • Go to the performance tab
  • Start a recording
  • Reproduce the performance issue
  • Stop the recording
  • Click 'save profile' - at least in theory, because for me this button does not work at the moment

For the backend, with a jvm profiler:

  • Install VisualVM using your package manager or go to https://visualvm.github.io/
  • Start IntelliJ
  • Start VisualVM.
  • In the Applications panel on the left, identify the correct instance of IntelliJ
  • Go to the Sampler tab.
  • Click CPU to start profiling
  • Reproduce the performance issue
  • Stop the profiling
  • Take a Snapshot to view and save results.
  • Now you can zip the nps file and upload it here on GitHub.

PHPirates avatar Oct 23 '24 19:10 PHPirates

Hey, sorry for the late reply. I did the first part - the save profile button works for me. Trace-20241103T124221.json

Please let me know if the information is helpful and if the second part is required.

AndyDekiert avatar Nov 03 '24 11:11 AndyDekiert

Thanks a lot! I don't see very strange things at first sight, but I will take a closer look later on.

I think the issue has nothing to do with the backend of the plugin, so profiling the Kotlin code probably won't be very useful.

PHPirates avatar Nov 07 '24 18:11 PHPirates

Any progress? Which older version doesn't have this problem? I would like to try to downgrade.

Edit: should have read the other comments đŸ˜… installing 0.16 solves the issue. The scrolling issue in 0.17 is unbearably annoying.

janoschp avatar Feb 04 '25 18:02 janoschp

Thanks for reporting this, we had this problem in the past (#51) but apparently it has come back. I don't have a Mac to test this with, so this may take a while to fix.

We are not listening directly for scroll wheel events anymore (causing slow callbacks), but possibly other events are causing this. Could you try these versions? intellij-pdf-viewer-0.17.1-alpha.1.1.zip intellij-pdf-viewer-0.17.1-alpha.1.2.zip intellij-pdf-viewer-0.17.1-alpha.1.3.zip

Is the problem also there if you right-click the pdf and select 'open in embedded browser'? If you do not see a context menu, it may help to go to Help > Find Action, search for Registry, set pdf.viewer.use.jcef.osr.view to false, and restart. See IJPL-59459 for more details.

The registry change worked for me on the newest IntelliJ Version on a Macbook Pro M1, thanks. (IntelliJ 2024.3.3 and PDF Virwer 0.17)

ThomasWagner-dev avatar Feb 19 '25 07:02 ThomasWagner-dev

If finding the root cause is hard, it's worth reverting all changes and release a 0.17.1 or 0.18.0 that is exactly the same as 0.16.0.

This bug is preventing mac users from using the plugin. My colleagues and I all agree that 0.17.0 is not useable (on macs), and I had to teach them how to install an old version. IDEs upgrade every a few weeks and it automatically updates plugins to the newest version, so we also had to frequently install the 0.16.0 version. The added featuers in 0.17.0 actually do not matter that much, and we are also unable to use them because 0.17.0 breaks the essential scrolling feature.

So I'm just honestly suggesting that we revert all changes back to a usable state :)

Him188 avatar Feb 19 '25 16:02 Him188

The registry change worked for me on the newest IntelliJ Version on a Macbook Pro M1, thanks. (IntelliJ 2024.3.3 and PDF Virwer 0.17)

@ThomasWagner-dev Do you mean the issue is not present when using the embedded browser? Because this comment https://github.com/FirstTimeInForever/intellij-pdf-viewer/issues/122#issuecomment-2431571012 says the issue is also there

PHPirates avatar Feb 21 '25 16:02 PHPirates

@Him188 I understand, but we can't support the older pdfjs version forever, and I will be moving forward with improvements based on the current situation since this issue only affects Mac users. I'm not saying that this issue is difficult to solve, just that it is difficult to solve without a Mac available to test it on, so I still have hope that someone with a Mac can help you Mac users with this. I can only do some blind guesses.

PHPirates avatar Feb 21 '25 16:02 PHPirates

Yeah just wanted to add, running a Mac on Sequoia 15.4 and I am also getting the scrolling issues. Weirdly enough, the issue seems to only be unusable when I use the touchpad to scroll, but using my mouse it seems fine (for me at least).

Let me know if I can help.

loicduchesne avatar Mar 12 '25 18:03 loicduchesne

@loicduchesne just downgrade to 0.16, there doesn't seem to be a fix in sight.

janoschp avatar Mar 16 '25 10:03 janoschp

@loicduchesne just downgrade to 0.16, there doesn't seem to be a fix in sight.

Is the registry fix not working for you?

willipreuk avatar Mar 16 '25 10:03 willipreuk

@loicduchesne just downgrade to 0.16, there doesn't seem to be a fix in sight.

Is the registry fix not working for you?

The "registry fix" only makes the "Open in Embedded Browser" context menu visible for me. The scrolling issue persists.

AndyDekiert avatar Mar 16 '25 11:03 AndyDekiert

And using the embedded browser is no option for you?

willipreuk avatar Mar 16 '25 13:03 willipreuk

It's just a workaround.

I currently resort to keyboard navigation, as the combo of quickly switching between the pdf and LaTeX code + working keyboard navigation is more important to me than the touchpad scrolling.

And downgrading is also not really a permanent fix as you have to do it every couple of days/weeks if the IDE is set to auto update (the other) plugins.

AndyDekiert avatar Mar 17 '25 08:03 AndyDekiert

Yes, I would recommend using 0.16.1 for now and I don't see any way to disable updates for a single plugin, assuming you are talking about File > Appearance & Behavior > System Settings > Updates > Update plugins automatically

It would be helpful if someone could help bisecting the issue:

intellij-pdf-viewer-0.16.1-70881dbc-30-8-12-48.zip

intellij-pdf-viewer-0.16.1-4aa43f17-14-9-12-28.zip

intellij-pdf-viewer-0.16.1-73cb4bdc-18-9-8-54.zip

intellij-pdf-viewer-0.16.1-7d25164e-23-9-1-28.zip

i

PHPirates avatar Mar 17 '25 09:03 PHPirates

Hey, thank you for looking into this even without owning a mac. The first two do not have the issue, the last two do.

johanohly avatar Mar 18 '25 10:03 johanohly

The first gives this error: "Error: The API version "4.10.38" does not match the Viewer version "4.6.82".", The second one works, The third one works, The fourth one has the problem,

The fifth one works but the sidebar looks funky,
The sixth one has the same error as the first, The seventh one has the same error as the first.

johanohly avatar Mar 20 '25 09:03 johanohly

Thanks! Then it must have been one of these commits, and lets double check the fifth one if I compiled it correctly:

intellij-pdf-viewer-0.16.1-10-34-c20bb229.zip I expect this one to work

intellij-pdf-viewer-0.16.1-14-22-9ab3433f.zip This one should have the problem

If that is all true, the problem was introduced in commit 9343f92f, updating from pdfjs 2.16.105 to 3.11.174

That makes me wonder if this one works:

plugin-0.17.1-alpha.3-2.16.105.zip

PHPirates avatar Mar 20 '25 09:03 PHPirates

The first one does work, the second one still has the console error, and the third has the problem

johanohly avatar Mar 20 '25 09:03 johanohly

Just to add another data point—the embedded browser has the same issue for me; however, setting pdf.viewer.use.jcef.osr.view to false resolved the issue. I'm running IntelliJ Ultimate 2024.3.1.1, PDF Viewer 0.17.0.

battery-staple avatar Mar 21 '25 22:03 battery-staple

Just to add another data point—the embedded browser has the same issue for me; however, setting pdf.viewer.use.jcef.osr.view to false resolved the issue. I'm running IntelliJ Ultimate 2024.3.1.1, PDF Viewer 0.17.0.

How to set pdf.viewer.use.jcef.osr.view in PDF Viewer 0.17.0, I couldn't find that setting.

yewenjiefjnu avatar Mar 26 '25 00:03 yewenjiefjnu

It's in the registry as mentioned in the above comment:

Is the problem also there if you right-click the pdf and select 'open in embedded browser'? If you do not see a context menu, it may help to go to Help > Find Action, search for Registry, set pdf.viewer.use.jcef.osr.view to false, and restart. See IJPL-59459 for more details.

https://github.com/FirstTimeInForever/intellij-pdf-viewer/issues/122#issuecomment-2425842610

battery-staple avatar Mar 26 '25 02:03 battery-staple

Hello, do you have any solution to fix that lag ?

lg933 avatar Apr 02 '25 16:04 lg933

Issue reappears in macOS 26 on PyCharm, even with the pdf.viewer.use.jcef.osr.view in the registry set to false.

acoustic-git-tar avatar Sep 16 '25 04:09 acoustic-git-tar