Nudges the position to fix inside a bounding box. */
| 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; |