circuitjs1 icon indicating copy to clipboard operation
circuitjs1 copied to clipboard

Component value scroll skips every other value

Open mordae opened this issue 3 years ago • 5 comments

(First of all, thanks for an awesome tool!)

When running on Fedora 36 with chrome-sandbox, component scroll skips every other value. This is with 2022-08-21 release from https://falstad.com/circuit/offline/.

Steps to reproduce:

  1. Place a fresh 1k resistor.
  2. Scroll down on it to select 1.2k.
  3. Instead of 1.2k, 1.5k is selected. 1.2k was clearly skipped.
  4. Scroll up to return to 1.2k.
  5. 1.2k was skipped again. Resistor is now at 1k.

mordae avatar Oct 17 '22 09:10 mordae

I have a similar problem with Windows 11 and Chrome 108.0.5359.125 This appears to be caused by the system's scale setting (in case of Windows, it is found in "System > Display > Scale"). With high resolution displays, Windows suggests a scale setting other than 100%, which also seems to affect the mouse wheel.

azambon avatar Dec 21 '22 19:12 azambon

A super-quick search yielded this page: https://stackoverflow.com/questions/1713771/how-to-detect-page-zoom-level-in-all-modern-browsers I tested the window.devicePixelRatio property both on Chrome and Edge, and in both cases it reports the correct scaling factor of 2.5 for my computer, which matches the 250% factor that is set in the Windows' settings.

So maybe it is enough to divide the MouseWheelEvent's delta value by this factor to fix the issue? But then the browser's zoom level would also affect the result...

azambon avatar Dec 21 '22 20:12 azambon

@pfalstad That's MUCH better now. Thank you! 👍

Although, the issue has not gone away completely, at least for me. For example, if I start with a 3k3 resistor and I scroll slowly to increase the value, some values are still being skipped, namely 5k6, 12k, 27k, 56k, 220k, 470k... This is still with the default 250% scale factor of my computer.

azambon avatar Jan 24 '23 19:01 azambon

For me (Fedora Linux, Firefox, 4K screen with 200% scaling, no browser zoom) it now takes 6 scroll steps to switch to the next value.

mordae avatar Feb 20 '23 17:02 mordae

It takes 2 for me. I will probably need to make it configurable to make everyone happy.

I see Firefox on Mac takes many more scroll steps to switch.

pfalstad avatar Feb 20 '23 19:02 pfalstad