Skip to content
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

KnobEventHandler motion event handling broken when using log scale #388

Open
sboettner opened this issue Nov 15, 2022 · 2 comments
Open

Comments

@sboettner
Copy link

If you set a knob to use a logarithmic scale, manipulating the knob value by clicking and dragging the mouse on the knob does not work correctly: The value remains on the minimum value or something very close to it. Changing the value using the mouse wheel works correctly.

Can be reproduced with the CairoUI example by inserting the following lines in the constructor:

fKnob->setRange(1.0f, 100.0f);
fKnob->setUsingLogScale(true);
@falkTX
Copy link
Contributor

falkTX commented Nov 15, 2022

thanks for the report.
it is likely a regression from the recent changes to fix integer behaviour

@joshsteffen
Copy link

I just ran into this and it looks like this commit got rid of some calls to invlogscale().

Adding a matching call to invlogscale() just above this seems to have fixed it, though I'm not familiar enough with the code to be confident that it's the Right Thing to do:

const float divisor = (ev.mod & kModifierControl) ? accel * 10.f : accel;
valueTmp += (maximum - minimum) / divisor * static_cast<float>(movDiff);
if (usingLog)
valueTmp = logscale(valueTmp);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants