Skip to content

Fix interactor style trackball camera mouse wheel event - #3581

Open
Jo-Byr wants to merge 2 commits into
Kitware:masterfrom
Jo-Byr:fix-interactor-style-trackball-camera-mouse-wheel-event
Open

Fix interactor style trackball camera mouse wheel event#3581
Jo-Byr wants to merge 2 commits into
Kitware:masterfrom
Jo-Byr:fix-interactor-style-trackball-camera-mouse-wheel-event

Conversation

@Jo-Byr

@Jo-Byr Jo-Byr commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Context

InteractorStyleTrackballCamera's mouseWheel to dolly factor formula has 2 issues:

  1. It's not symetrical (f(x) != 1/f(-x)) which makes a chain of zoom + dezoom different from a no-op.
  2. It prevents dezooming at zoomFactor === 1 (the current formula is 1 - spin / zoomFactor, which returns 0 0 for zoomFactor = 1 and x = 1, which is the value of a mouseWheel dezoom event by default)

Results

The new formula is symetrical and never reaches 0 to always allow zooming and dezooming.

Changes

Replaced the formula dollyFactor = 1 - spin / zoomFactor by dollyFactor = exp(- spin / zoomFactor)

PR and Code Checklist

  • semantic-release commit messages
  • Run npm run reformat to have correctly formatted code

@Jo-Byr
Jo-Byr requested a review from daker July 27, 2026 09:32
@Jo-Byr Jo-Byr self-assigned this Jul 27, 2026
Replace mouse wheel to dolly factor formula by negative exponential for
symmetry and to fix impossibility to dezoom at zoomFactor = 1
@Jo-Byr
Jo-Byr force-pushed the fix-interactor-style-trackball-camera-mouse-wheel-event branch from a132657 to 53e947f Compare July 27, 2026 09:37

@daker daker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, i let @finetjul do a final check

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.

2 participants