package com.pixelized.desktop.lwa.ui.composable.scene.cursor

import androidx.compose.runtime.Stable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.unit.IntOffset

@Stable
class Cursor(
    initial: IntOffset = IntOffset.Zero,
) {
    private val _offset = mutableStateOf(initial)
    val offset by _offset

    fun change(
        position: Offset,
    ) {
        _offset.value = IntOffset(
            x = position.x.toInt(),
            y = position.y.toInt(),
        )
    }
}