resizeBounds

fun resizeBounds(originalBounds: Rect, rotation: Float, handle: ResizeHandle, pointer: Offset): Rect

Compute new bounds when dragging handle of originalBounds to world-space pointer pointer. The opposite corner / edge midpoint stays anchored in world space, even when the element is rotated.

The math: with a rotation θ around the bbox center, applying the local-space handle drag shifts the bbox center from C_old to C_new. Without correction the opposite anchor (fixed in local space) drifts in world space by R_θ(C_new − C_old) − (C_new − C_old). We translate the new bounds by (I − R_θ)(C_old − C_new) to cancel that drift.