@jsvision/ui / translate
Function: translate()
translate(
r,dx,dy):Rect
Defined in: ui/src/view/geometry.ts:50
Offset a rect by (dx, dy), keeping its size — e.g. to convert view-local coordinates to absolute screen coordinates.
Parameters
r
The rect to move.
dx
number
Horizontal offset in cells.
dy
number
Vertical offset in cells.
Returns
A new translated rect (the input is not mutated).
Example
ts
import { translate } from '@jsvision/ui';
translate({ x: 2, y: 3, width: 8, height: 2 }, 10, 0);
// → { x: 12, y: 3, width: 8, height: 2 }