Skip to content

Commit fc4bfbb

Browse files
committed
fixed rotation issue for disabled keep aspect ratio option
1 parent 77fe073 commit fc4bfbb

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

octproz_project/octproz/src/glwindow2d.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,13 +334,17 @@ void GLWindow2D::paintGL() {
334334
glTranslatef(this->xTranslation, this->yTranslation, 0);
335335

336336
//rotation
337-
float screenWidth = static_cast<float>(this->size().width());
338-
float screenHeight = static_cast<float>(this->size().height());
339-
glScalef(1.0f,screenWidth/screenHeight,1.0f);
340-
glRotatef(this->rotationAngle, 0.0, 0.0, 1.0);
341-
glScalef(1.0f,screenHeight/screenWidth,1.0f);
337+
if(this->keepAspectRatio){
338+
float screenWidth = static_cast<float>(this->size().width());
339+
float screenHeight = static_cast<float>(this->size().height());
340+
glScalef(1.0f,screenWidth/screenHeight,1.0f);
341+
glRotatef(this->rotationAngle, 0.0, 0.0, 1.0);
342+
glScalef(1.0f,screenHeight/screenWidth,1.0f);
343+
}else{
344+
glRotatef(this->rotationAngle, 0.0, 0.0, 1.0);
345+
}
342346

343-
//zoom
347+
//zoom and stretch
344348
glScalef(this->scaleFactor*this->stretchX, this->scaleFactor*this->stretchY, 0.f);
345349

346350
//display oct data

0 commit comments

Comments
 (0)