Skip to content
Snippets Groups Projects
Commit b0d7de87 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Add hotkeys for different value increments in LLSpinCtrl

parent e9e4bed5
No related branches found
No related tags found
No related merge requests found
...@@ -175,7 +175,17 @@ void LLSpinCtrl::onUpBtn( const LLSD& data ) ...@@ -175,7 +175,17 @@ void LLSpinCtrl::onUpBtn( const LLSD& data )
F32 cur_val = (F32) atof(text.c_str()); F32 cur_val = (F32) atof(text.c_str());
// use getValue()/setValue() to force reload from/to control // use getValue()/setValue() to force reload from/to control
F32 val = cur_val + mIncrement; F32 val = cur_val;
if (gKeyboard->getKeyDown(KEY_SHIFT)) {
val = cur_val + (mIncrement * 0.01f);
} else if (gKeyboard->getKeyDown(KEY_CONTROL)) {
val = cur_val + (mIncrement * 0.1f);
} else if (gKeyboard->getKeyDown(KEY_ALT)) {
val = cur_val + (mIncrement * 10.f);
} else {
val = cur_val + mIncrement;
}
val = clamp_precision(val, mPrecision); val = clamp_precision(val, mPrecision);
val = llmin( val, mMaxValue ); val = llmin( val, mMaxValue );
if (val < mMinValue) val = mMinValue; if (val < mMinValue) val = mMinValue;
...@@ -208,7 +218,17 @@ void LLSpinCtrl::onDownBtn( const LLSD& data ) ...@@ -208,7 +218,17 @@ void LLSpinCtrl::onDownBtn( const LLSD& data )
LLLocale locale(LLLocale::USER_LOCALE); LLLocale locale(LLLocale::USER_LOCALE);
F32 cur_val = (F32) atof(text.c_str()); F32 cur_val = (F32) atof(text.c_str());
F32 val = cur_val - mIncrement; F32 val = cur_val;
if (gKeyboard->getKeyDown(KEY_SHIFT)) {
val = cur_val - (mIncrement * 0.01f);
} else if (gKeyboard->getKeyDown(KEY_CONTROL)) {
val = cur_val - (mIncrement * 0.1f);
} else if (gKeyboard->getKeyDown(KEY_ALT)) {
val = cur_val - (mIncrement * 10.f);
} else {
val = cur_val - mIncrement;
}
val = clamp_precision(val, mPrecision); val = clamp_precision(val, mPrecision);
val = llmax( val, mMinValue ); val = llmax( val, mMinValue );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment