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

Method nudge

include/math.hpp:393–399  ·  view source on GitHub ↗

Nudges the position to fix inside a bounding box. */

Source from the content-addressed store, hash-verified

391 }
392 /** Nudges the position to fix inside a bounding box. */
393 Rect nudge(Rect bound) const {
394 Rect r;
395 r.size = size;
396 r.pos.x = math::clampSafe(pos.x, bound.pos.x, bound.pos.x + bound.size.x - size.x);
397 r.pos.y = math::clampSafe(pos.y, bound.pos.y, bound.pos.y + bound.size.y - size.y);
398 return r;
399 }
400 /** Returns the bounding box of the union of `this` and `b`. */
401 Rect expand(Rect b) const {
402 Rect r;

Callers 5

stepMethod · 0.80
stepMethod · 0.80
stepMethod · 0.80
stepMethod · 0.80
stepMethod · 0.80

Calls 1

clampSafeFunction · 0.85

Tested by

no test coverage detected