Add remaining attributes arguments to feature builders

This commit is contained in:
Alexander Nozik 2023-02-22 12:20:32 +03:00
parent 1ca1b3cd43
commit 94a91e9ff9
3 changed files with 12 additions and 6 deletions

View File

@ -10,7 +10,7 @@ val kmathVersion: String by extra("0.3.1-dev-10")
allprojects { allprojects {
group = "center.sciprog" group = "center.sciprog"
version = "0.2.2-dev-7" version = "0.2.2-dev-8"
repositories { repositories {
mavenLocal() mavenLocal()

View File

@ -225,16 +225,18 @@ public fun <T : Any> FeatureGroup<T>.multiLine(
public fun <T : Any> FeatureGroup<T>.polygon( public fun <T : Any> FeatureGroup<T>.polygon(
points: List<T>, points: List<T>,
attributes: Attributes = Attributes.EMPTY,
id: String? = null, id: String? = null,
): FeatureRef<T, PolygonFeature<T>> = feature( ): FeatureRef<T, PolygonFeature<T>> = feature(
id, id,
PolygonFeature(space, points) PolygonFeature(space, points, attributes)
) )
public fun <T : Any> FeatureGroup<T>.image( public fun <T : Any> FeatureGroup<T>.image(
position: T, position: T,
image: ImageVector, image: ImageVector,
size: DpSize = DpSize(image.defaultWidth, image.defaultHeight), size: DpSize = DpSize(image.defaultWidth, image.defaultHeight),
attributes: Attributes = Attributes.EMPTY,
id: String? = null, id: String? = null,
): FeatureRef<T, VectorImageFeature<T>> = ): FeatureRef<T, VectorImageFeature<T>> =
feature( feature(
@ -244,33 +246,37 @@ public fun <T : Any> FeatureGroup<T>.image(
position, position,
size, size,
image, image,
attributes
) )
) )
public fun <T : Any> FeatureGroup<T>.group( public fun <T : Any> FeatureGroup<T>.group(
attributes: Attributes = Attributes.EMPTY,
id: String? = null, id: String? = null,
builder: FeatureGroup<T>.() -> Unit, builder: FeatureGroup<T>.() -> Unit,
): FeatureRef<T, FeatureGroup<T>> { ): FeatureRef<T, FeatureGroup<T>> {
val collection = FeatureGroup(space).apply(builder) val collection = FeatureGroup(space).apply(builder)
val feature = FeatureGroup(space, collection.featureMap) val feature = FeatureGroup(space, collection.featureMap, attributes)
return feature(id, feature) return feature(id, feature)
} }
public fun <T : Any> FeatureGroup<T>.scalableImage( public fun <T : Any> FeatureGroup<T>.scalableImage(
box: Rectangle<T>, box: Rectangle<T>,
attributes: Attributes = Attributes.EMPTY,
id: String? = null, id: String? = null,
painter: @Composable () -> Painter, painter: @Composable () -> Painter,
): FeatureRef<T, ScalableImageFeature<T>> = feature( ): FeatureRef<T, ScalableImageFeature<T>> = feature(
id, id,
ScalableImageFeature<T>(space, box, painter = painter) ScalableImageFeature<T>(space, box, painter = painter, attributes = attributes)
) )
public fun <T : Any> FeatureGroup<T>.text( public fun <T : Any> FeatureGroup<T>.text(
position: T, position: T,
text: String, text: String,
font: FeatureFont.() -> Unit = { size = 16f }, font: FeatureFont.() -> Unit = { size = 16f },
attributes: Attributes = Attributes.EMPTY,
id: String? = null, id: String? = null,
): FeatureRef<T, TextFeature<T>> = feature( ): FeatureRef<T, TextFeature<T>> = feature(
id, id,
TextFeature(space, position, text, fontConfig = font) TextFeature(space, position, text, fontConfig = font, attributes = attributes)
) )

View File

@ -151,7 +151,7 @@ private suspend fun AwaitPointerEventScope.consumeUntilUp() {
/** /**
* Waits for [ViewConfiguration.doubleTapTimeoutMillis] for a second press event. If a * Waits for [ViewConfiguration.doubleTapTimeoutMillis] for a second press event. If a
* second press event is received before the time out, it is returned or `null` is returned * second press event is received before the time-out, it is returned or `null` is returned
* if no second press is received. * if no second press is received.
*/ */
private suspend fun AwaitPointerEventScope.awaitSecondDown( private suspend fun AwaitPointerEventScope.awaitSecondDown(