diff --git a/include/math.hpp b/include/math.hpp index 0b94c9c1..815f3746 100644 --- a/include/math.hpp +++ b/include/math.hpp @@ -120,15 +120,6 @@ inline float sincf(float 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` 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 -It is of course acceptable to reuse arguments +Arguments may be the same pointers i.e. cmultf(&ar, &ai, ar, ai, br, bi) */ inline void cmultf(float *cr, float *ci, float ar, float ai, float br, float bi) { diff --git a/include/widgets.hpp b/include/widgets.hpp index 454c9c43..6c8fa9f3 100644 --- a/include/widgets.hpp +++ b/include/widgets.hpp @@ -178,6 +178,7 @@ struct ZoomWidget : Widget { void onMouseMove(EventMouseMove &e) override; void onHoverKey(EventHoverKey &e) override; void onScroll(EventScroll &e) override; + void onPathDrop(EventPathDrop &e) override; }; //////////////////// diff --git a/src/widgets/ZoomWidget.cpp b/src/widgets/ZoomWidget.cpp index c6d6cb5d..5ef4d335 100644 --- a/src/widgets/ZoomWidget.cpp +++ b/src/widgets/ZoomWidget.cpp @@ -65,5 +65,12 @@ void ZoomWidget::onScroll(EventScroll &e) { 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