Browse Source

Revert "Add ability to set scrolling step on knobs, does not apply to drag"

This reverts commit 2b27a7ab1e.

Closes #7
pull/7/merge
falkTX 7 years ago
parent
commit
affa0c3a50
2 changed files with 2 additions and 21 deletions
  1. +0
    -2
      dgl/ImageWidgets.hpp
  2. +2
    -19
      dgl/src/ImageWidgets.cpp

+ 0
- 2
dgl/ImageWidgets.hpp View File

@@ -112,7 +112,6 @@ public:
void setDefault(float def) noexcept;
void setRange(float min, float max) noexcept;
void setStep(float step) noexcept;
void setScrollStep(float step) noexcept;
void setValue(float value, bool sendCallback = false) noexcept;
void setUsingLogScale(bool yesNo) noexcept;

@@ -132,7 +131,6 @@ private:
Image fImage;
float fMinimum;
float fMaximum;
float fScrollStep;
float fStep;
float fValue;
float fValueDef;


+ 2
- 19
dgl/src/ImageWidgets.cpp View File

@@ -195,7 +195,6 @@ ImageKnob::ImageKnob(Window& parent, const Image& image, Orientation orientation
fImage(image),
fMinimum(0.0f),
fMaximum(1.0f),
fScrollStep(0.0f),
fStep(0.0f),
fValue(0.5f),
fValueDef(fValue),
@@ -224,7 +223,6 @@ ImageKnob::ImageKnob(Widget* widget, const Image& image, Orientation orientation
fImage(image),
fMinimum(0.0f),
fMaximum(1.0f),
fScrollStep(0.0f),
fStep(0.0f),
fValue(0.5f),
fValueDef(fValue),
@@ -253,7 +251,6 @@ ImageKnob::ImageKnob(const ImageKnob& imageKnob)
fImage(imageKnob.fImage),
fMinimum(imageKnob.fMinimum),
fMaximum(imageKnob.fMaximum),
fScrollStep(imageKnob.fScrollStep),
fStep(imageKnob.fStep),
fValue(imageKnob.fValue),
fValueDef(imageKnob.fValueDef),
@@ -282,7 +279,6 @@ ImageKnob& ImageKnob::operator=(const ImageKnob& imageKnob)
fImage = imageKnob.fImage;
fMinimum = imageKnob.fMinimum;
fMaximum = imageKnob.fMaximum;
fScrollStep = imageKnob.fScrollStep;
fStep = imageKnob.fStep;
fValue = imageKnob.fValue;
fValueDef = imageKnob.fValueDef;
@@ -367,11 +363,6 @@ void ImageKnob::setRange(float min, float max) noexcept
fMaximum = max;
}

void ImageKnob::setScrollStep(float step) noexcept
{
fScrollStep = step;
}

void ImageKnob::setStep(float step) noexcept
{
fStep = step;
@@ -608,16 +599,8 @@ bool ImageKnob::onScroll(const ScrollEvent& ev)
if (! contains(ev.pos))
return false;

float value, d;

if (d_isZero(fScrollStep)) {
d = (ev.mod & kModifierControl) ? 2000.0f : 200.0f;
value = (fUsingLog ? _invlogscale(fValueTmp) : fValueTmp) + (float(fMaximum - fMinimum) / d * 10.f * ev.delta.getY());
} else {
d = (ev.mod & kModifierControl) ? fScrollStep * 0.1f : fScrollStep;
value = (fUsingLog ? _invlogscale(fValueTmp + d * ev.delta.getY())
: fValueTmp + d * ev.delta.getY());
}
const float d = (ev.mod & kModifierControl) ? 2000.0f : 200.0f;
float value = (fUsingLog ? _invlogscale(fValueTmp) : fValueTmp) + (float(fMaximum - fMinimum) / d * 10.f * ev.delta.getY());

if (fUsingLog)
value = _logscale(value);


Loading…
Cancel
Save