| 600 | } |
| 601 | |
| 602 | vec2<i32> getLocalCoord(i32 x_world, i32 y_world) const FL_NOEXCEPT { |
| 603 | // clamp to [mBottomLeft, mTopRight] |
| 604 | i32 x_clamped = fl::clamp(x_world, mBottomLeft.x, mTopRight.x); |
| 605 | i32 y_clamped = fl::clamp(y_world, mBottomLeft.y, mTopRight.y); |
| 606 | // convert to local |
| 607 | return {x_clamped - mBottomLeft.x, y_clamped - mBottomLeft.y}; |
| 608 | } |
| 609 | |
| 610 | // element access via (x,y) |
| 611 | T &operator()(i32 x, i32 y) FL_NOEXCEPT { return at(x, y); } |