Browse Source

Added ZoomWidget::onPathDrop

pull/1639/head
Andrew Belt 7 years ago
parent
commit
182bf15fbe
3 changed files with 9 additions and 10 deletions
  1. +1
    -10
      include/math.hpp
  2. +1
    -0
      include/widgets.hpp
  3. +7
    -0
      src/widgets/ZoomWidget.cpp

+ 1
- 10
include/math.hpp View File

@@ -120,15 +120,6 @@ inline float sincf(float x) {
return sinf(x) / x; return sinf(x) / x;
} }


inline float getf(const float *p, float v = 0.0) {
return p ? *p : v;
}

inline void setf(float *p, float v) {
if (p)
*p = v;
}

/** Linearly interpolate an array `p` with index `x` /** Linearly interpolate an array `p` with index `x`
Assumes that the array at `p` is of length at least floor(x)+1. Assumes that the array at `p` is of length at least floor(x)+1.
*/ */
@@ -139,7 +130,7 @@ inline float interpf(const float *p, float x) {
} }


/** Complex multiply c = a * b /** Complex multiply c = a * b
It is of course acceptable to reuse arguments
Arguments may be the same pointers
i.e. cmultf(&ar, &ai, ar, ai, br, bi) i.e. cmultf(&ar, &ai, ar, ai, br, bi)
*/ */
inline void cmultf(float *cr, float *ci, float ar, float ai, float br, float bi) { inline void cmultf(float *cr, float *ci, float ar, float ai, float br, float bi) {


+ 1
- 0
include/widgets.hpp View File

@@ -178,6 +178,7 @@ struct ZoomWidget : Widget {
void onMouseMove(EventMouseMove &e) override; void onMouseMove(EventMouseMove &e) override;
void onHoverKey(EventHoverKey &e) override; void onHoverKey(EventHoverKey &e) override;
void onScroll(EventScroll &e) override; void onScroll(EventScroll &e) override;
void onPathDrop(EventPathDrop &e) override;
}; };


//////////////////// ////////////////////


+ 7
- 0
src/widgets/ZoomWidget.cpp View File

@@ -65,5 +65,12 @@ void ZoomWidget::onScroll(EventScroll &e) {
e.pos = pos; e.pos = pos;
} }


void ZoomWidget::onPathDrop(EventPathDrop &e) {
Vec pos = e.pos;
e.pos = e.pos.div(zoom);
Widget::onPathDrop(e);
e.pos = pos;
}



} // namespace rack } // namespace rack

Loading…
Cancel
Save