Add direct canvas customization for DeviceDrawable2D
This commit is contained in:
parent
fbf79f0a37
commit
f0f9d0e174
@ -14,7 +14,7 @@ import space.kscience.dataforge.context.Context
|
||||
|
||||
|
||||
/**
|
||||
* Virtual [LimitSwitch]
|
||||
* A device that detects if a motor hits the end of its range
|
||||
*/
|
||||
public class LimitSwitch(
|
||||
context: Context,
|
||||
|
@ -4,6 +4,7 @@ import androidx.compose.foundation.Canvas
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.geometry.Size
|
||||
import androidx.compose.ui.graphics.drawscope.DrawScope
|
||||
import androidx.compose.ui.graphics.drawscope.clipRect
|
||||
import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import androidx.compose.ui.unit.toSize
|
||||
@ -62,6 +63,7 @@ public fun <T, D : Device, P : DevicePropertySpec<D, T>> DeviceDrawable2DStore.o
|
||||
@Composable
|
||||
public fun Device2DCanvas(
|
||||
modifier: Modifier = Modifier,
|
||||
onDraw: DrawScope.() -> Unit = {},
|
||||
flowBuilder: suspend DeviceDrawable2DStore.() -> Unit,
|
||||
) {
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
@ -85,6 +87,7 @@ public fun Device2DCanvas(
|
||||
drawables.values.forEach {
|
||||
with(it) { draw() }
|
||||
}
|
||||
onDraw()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user