| 112 | |
| 113 | |
| 114 | void ScrollWidget::onButton(const ButtonEvent& e) { |
| 115 | math::Rect offsetBound = getContainerOffsetBound(); |
| 116 | // Check if scrollable |
| 117 | if (offsetBound.size.x > 0.f || offsetBound.size.y > 0.f) { |
| 118 | // Handle Alt-click before children, since most widgets consume Alt-click without needing to. |
| 119 | if (e.button == GLFW_MOUSE_BUTTON_LEFT && (e.mods & RACK_MOD_MASK) == GLFW_MOD_ALT) { |
| 120 | e.consume(this); |
| 121 | return; |
| 122 | } |
| 123 | // Might as well handle middle click before children as well. |
| 124 | if (e.button == GLFW_MOUSE_BUTTON_MIDDLE) { |
| 125 | e.consume(this); |
| 126 | return; |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | Widget::onButton(e); |
| 131 | } |
| 132 | |
| 133 | |
| 134 | void ScrollWidget::onDragStart(const DragStartEvent& e) { |