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

import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawWithCache
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.drawscope.Stroke
import com.pixelized.desktop.lwa.ui.composable.scene.camera.Camera
import com.pixelized.desktop.lwa.ui.composable.scene.utils.local

fun Modifier.drawCursors(
    camera: Camera,
    cursors: List<Cursor>,
): Modifier = this
    .drawWithCache {
        onDrawBehind {
            cursors.forEach { cursor ->
                drawRect(
                    color = Color.Green,
                    topLeft = cursor.offset.local(camera = camera),
                    size = Size(10f, 10f),
                    style = Stroke(width = 2f),
                )
            }
        }
    }