Skip to content

[internal-gestures] Inline wheel-delta clamp per axis#22331

Merged
JCQuintas merged 1 commit intomui:masterfrom
JCQuintas:fix/internal-gestures-wheel-clamp-inline
May 6, 2026
Merged

[internal-gestures] Inline wheel-delta clamp per axis#22331
JCQuintas merged 1 commit intomui:masterfrom
JCQuintas:fix/internal-gestures-wheel-clamp-inline

Conversation

@JCQuintas
Copy link
Copy Markdown
Member

Summary

The clamp loop iterated ['totalDeltaX', 'totalDeltaY', 'totalDeltaZ'] on every wheel event, allocating an array and a closure on a hot path.

Replace it with three inline Math.min/Math.max expressions and hoist the sensitivity-and-invert factor into a local rather than recomputing the ternary three times.

The clamp loop iterated `['totalDeltaX', 'totalDeltaY', 'totalDeltaZ']`
on every wheel event, allocating an array and a closure on a hot path.
Replace it with three inline Math.min/Math.max expressions. Also hoist
the sensitivity-and-invert factor into a local rather than recomputing
the ternary three times.
@JCQuintas JCQuintas added internal Behind-the-scenes enhancement. Formerly called “core”. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. labels May 5, 2026
@JCQuintas JCQuintas self-assigned this May 5, 2026
@code-infra-dashboard
Copy link
Copy Markdown

Deploy preview

https://deploy-preview-22331--material-ui-x.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts ▼-63B(-0.02%) ▼-3B(0.00%)
@mui/x-charts-pro ▼-63B(-0.01%) ▼-4B(0.00%)
@mui/x-charts-premium ▼-63B(-0.01%) ▼-3B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@JCQuintas JCQuintas marked this pull request as ready for review May 5, 2026 15:40
@JCQuintas JCQuintas requested a review from alexfauquette May 5, 2026 15:48
@JCQuintas JCQuintas merged commit dbe61f3 into mui:master May 6, 2026
24 checks passed
@JCQuintas JCQuintas deleted the fix/internal-gestures-wheel-clamp-inline branch May 6, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Behind-the-scenes enhancement. Formerly called “core”. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants