diff --git a/src/app/RackScrollWidget.cpp b/src/app/RackScrollWidget.cpp index 38ba09ef..1696e2c9 100644 --- a/src/app/RackScrollWidget.cpp +++ b/src/app/RackScrollWidget.cpp @@ -1,5 +1,8 @@ #include #include +#include +#include +#include #include #include #include @@ -95,11 +98,12 @@ void RackScrollWidget::step() { zoomWidget->box = scrollBox; rackWidget->box.pos = scrollBox.pos.div(zoom).neg(); - // Scroll rack if dragging cable near the edge of the screen + // Scroll rack if dragging certain widgets near the edge of the screen math::Vec pos = APP->scene->mousePos; math::Rect viewport = getViewport(box.zeroPos()); - widget::Widget* draggedWidget = APP->event->getDraggedWidget(); - if (draggedWidget && draggedWidget->isDescendantOf(container) && APP->event->dragButton == GLFW_MOUSE_BUTTON_LEFT) { + widget::Widget* dw = APP->event->getDraggedWidget(); + if (dw && APP->event->dragButton == GLFW_MOUSE_BUTTON_LEFT && + (dynamic_cast(dw) || dynamic_cast(dw) || dynamic_cast(dw))) { float margin = 20.0; float speed = 15.0; if (pos.x <= viewport.pos.x + margin)