Skip to content

Commit

Permalink
Merge pull request #531 from felixveysseyre/handle-pinch-fix
Browse files Browse the repository at this point in the history
fix(interaction): Fixed issue when scrolling in unclicked window
  • Loading branch information
jourdain authored Jan 25, 2018
2 parents a0f40de + 24f670f commit 4d43eb5
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions Sources/Interaction/Style/InteractorStyleTrackballCamera/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,25 +183,28 @@ function vtkInteractorStyleTrackballCamera(publicAPI, model) {
const pos = model.interactor.getEventPosition(
model.interactor.getPointerIndex()
);
publicAPI.findPokedRenderer(pos.x, pos.y);
if (model.currentRenderer === null) {
return;
}

const camera = model.currentRenderer.getActiveCamera();
if (pos) {
publicAPI.findPokedRenderer(pos.x, pos.y);
if (model.currentRenderer === null) {
return;
}

const dyf = model.interactor.getScale() / model.interactor.getLastScale();
if (camera.getParallelProjection()) {
camera.setParallelScale(camera.getParallelScale() / dyf);
} else {
camera.dolly(dyf);
if (model.autoAdjustCameraClippingRange) {
model.currentRenderer.resetCameraClippingRange();
const camera = model.currentRenderer.getActiveCamera();

const dyf = model.interactor.getScale() / model.interactor.getLastScale();
if (camera.getParallelProjection()) {
camera.setParallelScale(camera.getParallelScale() / dyf);
} else {
camera.dolly(dyf);
if (model.autoAdjustCameraClippingRange) {
model.currentRenderer.resetCameraClippingRange();
}
}
}

if (model.interactor.getLightFollowCamera()) {
model.currentRenderer.updateLightsGeometryToFollowCamera();
if (model.interactor.getLightFollowCamera()) {
model.currentRenderer.updateLightsGeometryToFollowCamera();
}
}
};

Expand Down

0 comments on commit 4d43eb5

Please sign in to comment.