| 143 | |
| 144 | |
| 145 | void ScrollWidget::onHoverScroll(const HoverScrollEvent& e) { |
| 146 | OpaqueWidget::onHoverScroll(e); |
| 147 | if (e.isConsumed()) |
| 148 | return; |
| 149 | |
| 150 | // Check if scrollable |
| 151 | math::Rect offsetBound = getContainerOffsetBound(); |
| 152 | if (offsetBound.size.x <= 0.f && offsetBound.size.y <= 0.f) |
| 153 | return; |
| 154 | |
| 155 | math::Vec scrollDelta = e.scrollDelta; |
| 156 | // Flip coordinates if shift is held |
| 157 | // Mac (or GLFW?) already does this for us. |
| 158 | #if !defined ARCH_MAC |
| 159 | int mods = APP->window->getMods(); |
| 160 | if ((mods & RACK_MOD_MASK) & GLFW_MOD_SHIFT) |
| 161 | scrollDelta = scrollDelta.flip(); |
| 162 | #endif |
| 163 | |
| 164 | offset = offset.minus(scrollDelta); |
| 165 | e.consume(this); |
| 166 | internal->scrolling = true; |
| 167 | } |
| 168 | |
| 169 | |
| 170 | void ScrollWidget::onHoverKey(const HoverKeyEvent& e) { |
nothing calls this directly
no test coverage detected