canvasToCga

fun canvasToCga(position: Offset, size: Size, scale: Float = 1.0f): FlatPoint

Returns the model-space FlatPoint under the canvas position — the pointer-input inverse of cgaToCanvas.

The inverse mapping against the same size and scale: subtract the canvas center, flip Y, divide by scale — computed raw in Double from the Float position. Pass the scale the draw pass actually used, fitScale over the same surface size, scene bounds, and density — a mismatched scale lands converted positions beside the shapes they point at.

Return

The FlatPoint at that position in model space.

Parameters

position

The canvas position in physical px.

size

The canvas size in physical px.

scale

Physical px per CGA unit; the default 1f reads px as model units directly.