FirstTimeInForever / intellij-pdf-viewer

Plugin for viewing PDF documents in IntelliJ-based IDEs.
https://github.com/FirstTimeInForever/intellij-pdf-viewer
MIT License
84 stars 18 forks source link

Scrolling on mac has high delay #122

Open AndyDekiert opened 1 month ago

AndyDekiert commented 1 month ago

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.

willipreuk commented 1 month ago

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

PHPirates commented 1 month ago

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.

willipreuk commented 1 month ago

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.

AndyDekiert commented 1 month ago

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 commented 1 month ago

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.

PHPirates commented 1 month ago

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,

For the backend, with a jvm profiler:

AndyDekiert commented 3 weeks ago

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.

PHPirates commented 2 weeks ago

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.