From 94a91e9ff95c2c48b97b13284716d21b0483da9c Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 22 Feb 2023 12:20:32 +0300 Subject: [PATCH] Add remaining attributes arguments to feature builders --- build.gradle.kts | 2 +- .../center/sciprog/maps/features/FeatureGroup.kt | 14 ++++++++++---- .../center/sciprog/maps/compose/clickGestures.kt | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index c7d36f1..643d0b8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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() diff --git a/maps-kt-features/src/commonMain/kotlin/center/sciprog/maps/features/FeatureGroup.kt b/maps-kt-features/src/commonMain/kotlin/center/sciprog/maps/features/FeatureGroup.kt index 092f461..5face58 100644 --- a/maps-kt-features/src/commonMain/kotlin/center/sciprog/maps/features/FeatureGroup.kt +++ b/maps-kt-features/src/commonMain/kotlin/center/sciprog/maps/features/FeatureGroup.kt @@ -225,16 +225,18 @@ public fun FeatureGroup.multiLine( public fun FeatureGroup.polygon( points: List, + attributes: Attributes = Attributes.EMPTY, id: String? = null, ): FeatureRef> = feature( id, - PolygonFeature(space, points) + PolygonFeature(space, points, attributes) ) public fun FeatureGroup.image( position: T, image: ImageVector, size: DpSize = DpSize(image.defaultWidth, image.defaultHeight), + attributes: Attributes = Attributes.EMPTY, id: String? = null, ): FeatureRef> = feature( @@ -244,33 +246,37 @@ public fun FeatureGroup.image( position, size, image, + attributes ) ) public fun FeatureGroup.group( + attributes: Attributes = Attributes.EMPTY, id: String? = null, builder: FeatureGroup.() -> Unit, ): FeatureRef> { 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 FeatureGroup.scalableImage( box: Rectangle, + attributes: Attributes = Attributes.EMPTY, id: String? = null, painter: @Composable () -> Painter, ): FeatureRef> = feature( id, - ScalableImageFeature(space, box, painter = painter) + ScalableImageFeature(space, box, painter = painter, attributes = attributes) ) public fun FeatureGroup.text( position: T, text: String, font: FeatureFont.() -> Unit = { size = 16f }, + attributes: Attributes = Attributes.EMPTY, id: String? = null, ): FeatureRef> = feature( id, - TextFeature(space, position, text, fontConfig = font) + TextFeature(space, position, text, fontConfig = font, attributes = attributes) ) diff --git a/maps-kt-features/src/jvmMain/kotlin/center/sciprog/maps/compose/clickGestures.kt b/maps-kt-features/src/jvmMain/kotlin/center/sciprog/maps/compose/clickGestures.kt index 59ca93c..9e1af37 100644 --- a/maps-kt-features/src/jvmMain/kotlin/center/sciprog/maps/compose/clickGestures.kt +++ b/maps-kt-features/src/jvmMain/kotlin/center/sciprog/maps/compose/clickGestures.kt @@ -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(