Skip to content

Commit 4b319ce

Browse files
dakerfinetjul
authored andcommitted
fix(InteractorStyleTrackballCamera): stop mouse move amplifying wheel zoom
fixes #2636
1 parent f8c70f1 commit 4b319ce

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

  • Sources/Interaction/Style/InteractorStyleTrackballCamera

Sources/Interaction/Style/InteractorStyleTrackballCamera/index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@ function vtkInteractorStyleTrackballCamera(publicAPI, model) {
3636
break;
3737

3838
case States.IS_DOLLY:
39-
publicAPI.handleMouseDolly(renderer, pos);
40-
publicAPI.invokeInteractionEvent({ type: 'InteractionEvent' });
39+
// Wheel zoom uses the dolly state too, we should ignore pointer movement
40+
// so the mouse position does not amplify wheel zoom while scrolling.
41+
if (!model.wheelDolly) {
42+
publicAPI.handleMouseDolly(renderer, pos);
43+
publicAPI.invokeInteractionEvent({ type: 'InteractionEvent' });
44+
}
4145
break;
4246

4347
case States.IS_SPIN:
@@ -154,12 +158,14 @@ function vtkInteractorStyleTrackballCamera(publicAPI, model) {
154158

155159
//----------------------------------------------------------------------------
156160
publicAPI.handleStartMouseWheel = () => {
161+
model.wheelDolly = true;
157162
publicAPI.startDolly();
158163
};
159164

160165
//--------------------------------------------------------------------------
161166
publicAPI.handleEndMouseWheel = () => {
162167
publicAPI.endDolly();
168+
model.wheelDolly = false;
163169
};
164170

165171
//----------------------------------------------------------------------------
@@ -448,6 +454,7 @@ function vtkInteractorStyleTrackballCamera(publicAPI, model) {
448454
const DEFAULT_VALUES = {
449455
motionFactor: 10.0,
450456
zoomFactor: 10.0,
457+
wheelDolly: false,
451458
};
452459

453460
// ----------------------------------------------------------------------------

0 commit comments

Comments
 (0)