SpatialOffset

class SpatialOffset(offset: Offset, val space: CoordinateSpace)

A 2D offset bound to a specific CoordinateSpace inside a CoordinateSystem.

SpatialOffset ensures that geometric data is always contextualized, preventing miscalculations across incompatible coordinate spaces (e.g., viewport vs. image space).

For reading the offset in a space, use SpatialOffset.offsetIn with a CoordinateSystem receiver:

val offsetInViewport = SpatialOffset(
offset = Offset(100f, 200f),
space = CoordinateSpace.Viewport,
)

val offsetInImage: Offset = with(zoomableState.coordinateSystem) {
offsetInViewport.offsetIn(CoordinateSpace.ZoomableContent)
}

Constructors

Link copied to clipboard
constructor(offset: Offset, space: CoordinateSpace)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

If this Offset then this is returned, otherwise block is executed and its result is returned.