fix featureGroup remember

This commit is contained in:
Alexander Nozik 2023-01-06 10:47:24 +03:00
parent ad938a614a
commit f288a17243
5 changed files with 4 additions and 6 deletions

View File

@ -37,7 +37,7 @@ fun App() {
text(1132.0881 to 394.99127, "Ordruin").color(Color.Red)
arc(center = 1132.0881 to 394.99127, radius = 20f, startAngle = 0f, 2 * PI.toFloat())
circle(410.52737 to 868.7676, id = "hobbit")
//circle(410.52737 to 868.7676, id = "hobbit")
scope.launch {
var t = 0.0

View File

@ -187,7 +187,7 @@ public data class FeatureGroup<T : Any>(
public fun <T : Any> remember(
coordinateSpace: CoordinateSpace<T>,
builder: FeatureGroup<T>.() -> Unit = {},
): FeatureGroup<T> = remember(builder) {
): FeatureGroup<T> = remember{
build(coordinateSpace, builder)
}

View File

@ -8,7 +8,6 @@ import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import center.sciprog.attributes.Attributes
import center.sciprog.attributes.ZAttribute
import center.sciprog.maps.features.*
internal fun Pair<Number, Number>.toCoordinates(): XY = XY(first.toFloat(), second.toFloat())

View File

@ -93,7 +93,7 @@ public fun SchemeView(
}
}
val state = rememberMapState(
val state = XYViewScope.remember(
config,
initialViewPoint = initialViewPoint,
initialRectangle = initialRectangle ?: featureState.features.computeBoundingBox(XYCoordinateSpace, Float.MAX_VALUE),
@ -118,7 +118,7 @@ public fun SchemeView(
buildFeatures: FeatureGroup<XY>.() -> Unit = {},
) {
val featureState = FeatureGroup.remember(XYCoordinateSpace, buildFeatures)
val mapState: XYViewScope = rememberMapState(
val mapState: XYViewScope = XYViewScope.remember(
config,
initialViewPoint = initialViewPoint,
initialRectangle = initialRectangle ?: featureState.features.computeBoundingBox(XYCoordinateSpace, Float.MAX_VALUE),

View File

@ -8,7 +8,6 @@ import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.graphics.drawscope.drawIntoCanvas
import androidx.compose.ui.graphics.drawscope.translate
import androidx.compose.ui.graphics.painter.Painter
import center.sciprog.attributes.AlphaAttribute
import center.sciprog.maps.features.*
import center.sciprog.maps.scheme.*
import org.jfree.svg.SVGGraphics2D