MCPcopy Create free account
hub / github.com/VCVRack/Rack / onHoverScroll

Method onHoverScroll

src/ui/ScrollWidget.cpp:145–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143
144
145void 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
170void ScrollWidget::onHoverKey(const HoverKeyEvent& e) {

Callers

nothing calls this directly

Calls 5

isConsumedMethod · 0.80
getModsMethod · 0.80
flipMethod · 0.80
minusMethod · 0.80
consumeMethod · 0.80

Tested by

no test coverage detected