Fix Jittery editor mouse wheel zoom when setting window.zoomLevel = 1 #227916
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related Issue
Fixes #225759
Changes
_isAlmostInt
method in theMouseWheelClassifier
class to increase the margin of error.0.01
to0.01 + Number.EPSILON * 100
(approximately 0.010000000000022205).Reason for Change
To account for floating-point errors in certain zoom level calculations.
Previous Behavior
deltaY = 0.996 ~ 1
and_isAlmostInt
correctly returnedtrue
.deltaY
of 0.9899999999999999,_isAlmostInt
incorrectly returnedfalse
.New Behavior
_isAlmostInt
now correctly returnstrue
for zoom level 1 cases, as intended.Testing
_isAlmostInt
returnstrue
fordeltaY
values very close to 1.Additional Notes
This change helps maintain consistent behavior across different zoom levels, addressing edge cases where floating-point precision was causing unexpected results.