MCPcopy Create free account
hub / github.com/chrxh/alien / processMouseWheel

Method processMouseWheel

source/Gui/SimulationInteractionController.cpp:305–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303}
304
305void SimulationInteractionController::processMouseWheel(IntVector2D const& mousePos)
306{
307 if (_mouseWheelAction) {
308 auto zoomFactor = powf(calcZoomFactor(_mouseWheelAction->lastTime), 2.2f * _mouseWheelAction->strongness);
309 auto now = std::chrono::steady_clock::now();
310 _mouseWheelAction->lastTime = now;
311 Viewport::get().zoom(mousePos, _mouseWheelAction->up ? zoomFactor : 1.0f / zoomFactor);
312 if (std::chrono::duration_cast<std::chrono::milliseconds>(now - _mouseWheelAction->start).count() > 100) {
313 _mouseWheelAction.reset();
314 }
315 }
316}
317
318void SimulationInteractionController::middleMouseButtonPressed(IntVector2D const& mousePos)
319{

Callers

nothing calls this directly

Calls 2

zoomMethod · 0.80
resetMethod · 0.80

Tested by

no test coverage detected