Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bugs in mouse panning when viewport is "portrait" orientation
  • Loading branch information
ianrrees authored and wwmayer committed Jul 29, 2014
1 parent 290bc13 commit c10ddae
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Gui/NavigationStyle.cpp
Expand Up @@ -616,6 +616,11 @@ void NavigationStyle::panCamera(SoCamera * cam, float aspectratio, const SbPlane

// Find projection points for the last and current mouse coordinates.
SbViewVolume vv = cam->getViewVolume(aspectratio);

// See note in Coin docs for SoCamera::getViewVolume re:viewport mapping
if(aspectratio < 1.0)
vv.scale(1.0 / aspectratio);

SbLine line;
vv.projectPointToLine(currpos, line);
SbVec3f current_planept;
Expand All @@ -639,7 +644,13 @@ void NavigationStyle::pan(SoCamera* camera)
}
else {
const SbViewportRegion & vp = viewer->getViewportRegion();
SbViewVolume vv = camera->getViewVolume(vp.getViewportAspectRatio());
float aspectratio = vp.getViewportAspectRatio();
SbViewVolume vv = camera->getViewVolume(aspectratio);

// See note in Coin docs for SoCamera::getViewVolume re:viewport mapping
if(aspectratio < 1.0)
vv.scale(1.0 / aspectratio);

this->panningplane = vv.getPlane(camera->focalDistance.getValue());
}
}
Expand Down

0 comments on commit c10ddae

Please sign in to comment.