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

Method onHoverScroll

src/app/RackScrollWidget.cpp:156–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154
155
156void RackScrollWidget::onHoverScroll(const HoverScrollEvent& e) {
157 int mods = APP->window->getMods();
158 bool doZoom = mods & RACK_MOD_CTRL;
159 if (settings::mouseWheelZoom)
160 doZoom ^= true;
161
162 if (doZoom) {
163 // Dispatch to children first and zoom only if they don't consume
164 OpaqueWidget::onHoverScroll(e);
165 if (e.isConsumed())
166 return;
167 // Increase zoom
168 float zoomDelta = e.scrollDelta.y / 50 / 4;
169 if (settings::invertZoom)
170 zoomDelta *= -1;
171 float zoom = getZoom() * std::pow(2.f, zoomDelta);
172 setZoom(zoom, e.pos);
173 e.consume(this);
174 return;
175 }
176
177 ScrollWidget::onHoverScroll(e);
178}
179
180
181void RackScrollWidget::onHover(const HoverEvent& e) {

Callers

nothing calls this directly

Calls 4

powFunction · 0.85
getModsMethod · 0.80
isConsumedMethod · 0.80
consumeMethod · 0.80

Tested by

no test coverage detected