Skip to content

Conversation

@enhancer13
Copy link

@enhancer13 enhancer13 commented Apr 20, 2025

PR Checklist

Please review the guidelines for contributing to this repository.

  • I am requesting to pull a topic/feature/bugfix branch (right side). In other words, not main.
  • I have run npm test against my changes and tests pass.
  • I have added tests to prove my fix is effective or my feature works. This can be done in the form of unit tests in test/unit/ or a new or altered demo in demo/.
  • I have added or edited necessary types and generated documentation (npm run docs), or no docs changes are needed.

Description

This PR introduces a new scaleSmoothing option to address visual instability during rapid pinch-zoom gestures on mobile devices.

Problem: Fast pinch gestures on touchscreens caused trembling/jittering due to immediate scale changes between gesture events. Existing animation options weren't suitable for real-time gesture handling.
before_fix

  { scale: 1.253061, positions: [100,100,150,100] }, // +25.3%
  { scale: 1.175761, positions: [100,100,145,100] }, // -6.2%
  { scale: 0.947083, positions: [100,100,130,100] }, // -24.3% 
  { scale: 1.055873, positions: [100,100,140,100] }, // +11.5%
  { scale: 0.990737, positions: [100,100,135,100] }  // -6.5%

Solution:

  • Implement frame blending using smoothing factor (0-1)
  • scaleSmoothing: 0 - Immediate scale changes (existing behavior)
  • scaleSmoothing: 0.5 - Blends 50% of new scale with 50% previous scale
    after_fix

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.

1 participant