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 {
group = "center.sciprog"
version = "0.2.2-dev-7"
version = "0.2.2-dev-8"
repositories {
mavenLocal()

View File

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