Spatial Offset
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)
}Content copied to clipboard
Properties
Link copied to clipboard
false when this is SpatialOffset.Unspecified.
Link copied to clipboard
true when this is SpatialOffset.Unspecified.
Link copied to clipboard