MAINT-731 Fixed Images Do Not Show at Proper Proportions

master
andreykproductengine 2017-05-30 16:28:07 +03:00
parent 0a90cc9746
commit 40011e3b65
1 changed files with 16 additions and 1 deletions

View File

@ -61,6 +61,8 @@
#include "fscommon.h"
#include "llviewermenu.h"
#include <boost/lexical_cast.hpp>
const S32 CLIENT_RECT_VPAD = 4;
const F32 SECONDS_TO_SHOW_FILE_SAVED_MSG = 8.f;
@ -1037,7 +1039,11 @@ void LLPreviewTexture::adjustAspectRatio()
std::vector<std::string>::const_iterator found = std::find(mRatiosList.begin(), mRatiosList.end(), ratio.str());
if (found == mRatiosList.end())
{
combo->setCurrentByIndex(0);
// No existing ratio found, create an element that will show image at original ratio
std::string ratio = boost::lexical_cast<std::string>(num)+":" + boost::lexical_cast<std::string>(denom);
mRatiosList.push_back(ratio);
combo->add(ratio);
combo->setCurrentByIndex(mRatiosList.size()- 1);
}
else
{
@ -1045,6 +1051,15 @@ void LLPreviewTexture::adjustAspectRatio()
}
}
}
else
{
// Aspect ratio was set to unconstrained or was clamped
LLComboBox* combo = getChild<LLComboBox>("combo_aspect_ratio");
if (combo)
{
combo->setCurrentByIndex(0); //unconstrained
}
}
mUpdateDimensions = TRUE;
}