line builder for scheme

This commit is contained in:
Alexander Nozik 2022-09-17 11:49:39 +03:00
parent 354cd8c9a2
commit 9c5c4b5747
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357

View File

@ -121,13 +121,24 @@ fun SchemeFeaturesState.draw(
drawFeature: DrawScope.() -> Unit, drawFeature: DrawScope.() -> Unit,
) = addFeature(id, SchemeDrawFeature(position.toCoordinates(), scaleRange, drawFeature)) ) = addFeature(id, SchemeDrawFeature(position.toCoordinates(), scaleRange, drawFeature))
fun SchemeFeaturesState.line(
aCoordinates: SchemeCoordinates,
bCoordinates: SchemeCoordinates,
scaleRange: FloatRange = defaultScaleRange,
color: Color = Color.Red,
id: FeatureId? = null,
): FeatureId = addFeature(
id,
SchemeLineFeature(aCoordinates, bCoordinates, scaleRange, color)
)
fun SchemeFeaturesState.line( fun SchemeFeaturesState.line(
aCoordinates: Pair<Number, Number>, aCoordinates: Pair<Number, Number>,
bCoordinates: Pair<Number, Number>, bCoordinates: Pair<Number, Number>,
scaleRange: FloatRange = defaultScaleRange, scaleRange: FloatRange = defaultScaleRange,
color: Color = Color.Red, color: Color = Color.Red,
id: FeatureId? = null, id: FeatureId? = null,
) = addFeature(id, SchemeLineFeature(aCoordinates.toCoordinates(), bCoordinates.toCoordinates(), scaleRange, color)) ) = line(aCoordinates.toCoordinates(), bCoordinates.toCoordinates(), scaleRange, color, id)
public fun SchemeFeaturesState.arc( public fun SchemeFeaturesState.arc(
oval: SchemeRectangle, oval: SchemeRectangle,