-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fixes rounding issue in automatablemodel #3597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Tested. It works well. |
|
Can you adress @zapashcanon's comment from here too: #3075 (comment) Tested it out, works like a charm |
|
@Umcaruje yes, I noticed it. I'll change that line. 👍 |
zonkmachine
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested the last commit and it clears up the earlier stickyness. The code looks much better.
| if( qAbs( value ) >= step ) | ||
| { | ||
| float roundedValue = static_cast<float>( static_cast<int>( ( oldValue - value ) / step + 0.5 ) ) * step; | ||
| float roundedValue = qRound( ( oldValue - value ) / step ) * step; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this code:
if( qAbs( value ) >= step )
{
float roundedValue = qRound( ( oldValue - value ) / step ) * step;
model()->setValue( roundedValue );
m_leftOver = 0.0f;
}
else
{
m_leftOver = value;
}is duplicated, maybe something like:
float consideredValue = value; // linear code
if( model()->isScaleLogarithmic() ) // logarithmic code
{
const float pos = model()->minValue() < 0
? oldValue / qMax( qAbs( model()->maxValue() ), qAbs( model()->minValue() ) )
: ( oldValue - model()->minValue() ) / model()->range();
const float ratio = 0.1f + qAbs( pos ) * 15.f;
consideredValue = value * ratio;
}
if( qAbs( consideredValue ) >= step )
{
float roundedValue = qRound( ( oldValue - value ) / step ) * step;
model()->setValue( roundedValue );
m_leftOver = 0.0f;
}
else
{
m_leftOver = value;
}* fixes rounding issue in automatablemodel * fix CRS knob sticking in instrument plugins
|
Cherry-picked to master via 902493b. Please target non-essential code cleanup at the master branch, once this fix is merged in. |
* fixes rounding issue in automatablemodel * fix CRS knob sticking in instrument plugins
* fixes rounding issue in automatablemodel * fix CRS knob sticking in instrument plugins
* fixes rounding issue in automatablemodel * fix CRS knob sticking in instrument plugins
fixes #3075 (comment), #3661, #3659