Skip to content

Conversation

@Jose-AE
Copy link
Contributor

@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
@Jose-AE Jose-AE force-pushed the zoom-level-1-fix branch 2 times, most recently from cae43d0 to 29d061b Compare September 25, 2024 04:50
@Jose-AE
Copy link
Contributor Author

Jose-AE commented Sep 25, 2024

Hi @alexdima , Could you please review the changes I made and let me know if they're ready to be merged or if anything needs to be revised?

Copy link
Member

@alexdima alexdima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you and apologies for the slow turn-around time!

@alexdima alexdima enabled auto-merge (squash) July 14, 2025 21:37
@vs-code-engineering vs-code-engineering bot added this to the July 2025 milestone Jul 14, 2025
@alexdima alexdima merged commit e9df78f into microsoft:main Jul 14, 2025
17 checks passed
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Aug 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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

4 participants