Skip to content
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

Fix Jittery editor mouse wheel zoom when setting window.zoomLevel = 1 #227916

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Jose-AE
Copy link

@Jose-AE Jose-AE commented Sep 8, 2024

Related Issue

Fixes #225759

Changes

  • Modified the _isAlmostInt method in the MouseWheelClassifier class to increase the margin of error.
  • Changed the threshold from 0.01 to 0.01 + Number.EPSILON * 100 (approximately 0.010000000000022205).

Reason for Change

To account for floating-point errors in certain zoom level calculations.

Previous Behavior

  • For most zoom levels deltaY = 0.996 ~ 1 and _isAlmostInt correctly returned true.
  • At zoom level 1, with deltaY of 0.9899999999999999, _isAlmostInt incorrectly returned false.

New Behavior

  • _isAlmostInt now correctly returns true for zoom level 1 cases, as intended.

Testing

  1. Set zoom level to 1.
  2. Verify that _isAlmostInt returns true for deltaY values very close to 1.
  3. Check that the method still behaves correctly for other zoom levels.

Additional Notes

This change helps maintain consistent behavior across different zoom levels, addressing edge cases where floating-point precision was causing unexpected results.

@Jose-AE Jose-AE force-pushed the zoom-level-1-fix branch 2 times, most recently from dbe32e8 to d4f1de1 Compare September 11, 2024 00:50
@Jose-AE Jose-AE marked this pull request as draft September 11, 2024 01:23
@Jose-AE Jose-AE marked this pull request as ready for review September 11, 2024 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jittery editor mouse wheel zoom when setting "window.zoomLevel" has a value of 1
3 participants