Browse Source

Fixed MenuOverlay "flicker"

tags/v0.3.1
Andrew Belt 7 years ago
parent
commit
72593654ea
2 changed files with 5 additions and 3 deletions
  1. +4
    -2
      include/math.hpp
  2. +1
    -1
      src/widgets/MenuOverlay.cpp

+ 4
- 2
include/math.hpp View File

@@ -59,9 +59,11 @@ inline float eucmodf(float a, float base) {
return mod < 0.0 ? mod + base : mod;
}

/** Limits a value between a minimum and maximum */
/** Limits a value between a minimum and maximum
If min < max, returns max
*/
inline float clampf(float x, float min, float max) {
return x > max ? max : x < min ? min : x;
return fmaxf(min, fminf(max, x));
}

/** If the magnitude of x if less than eps, return 0 */


+ 1
- 1
src/widgets/MenuOverlay.cpp View File

@@ -6,7 +6,7 @@ namespace rack {
void MenuOverlay::step() {
// Try to fit all children into the overlay's box
for (Widget *child : children) {
child->box = child->box.clamp(box);
child->box = child->box.clamp(Rect(Vec(0, 0), box.size));
}
}



Loading…
Cancel
Save