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

Method zoomToBound

src/app/RackScrollWidget.cpp:81–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79
80
81void RackScrollWidget::zoomToBound(math::Rect bound) {
82 if (!bound.pos.isFinite())
83 return;
84 bound = bound.grow(math::Vec(24, 24));
85 math::Vec size = getSize();
86 float zoom = std::min(size.x / bound.size.x, size.y / bound.size.y);
87 offset = bound.getCenter() * zoom - size / 2;
88 zoomWidget->setZoom(zoom);
89}
90
91
92void RackScrollWidget::step() {

Callers 2

onHoverKeyMethod · 0.80
createContextMenuMethod · 0.80

Calls 6

VecClass · 0.85
minFunction · 0.85
isFiniteMethod · 0.80
growMethod · 0.80
getCenterMethod · 0.80
setZoomMethod · 0.45

Tested by

no test coverage detected